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

Guardians do not spawn in deep ocean biome in place of other water mobs when spawn-limits are disabled. #22

Open
waseric opened this issue Aug 7, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@waseric
Copy link

waseric commented Aug 7, 2021

Please paste the output from /usb version below

Name: uSkyBlock
Version: 2.9.0
Description: Ultimate SkyBlock v2.9.0-7cf840c
Language: en (en)
State: d=128, r=48, i=447, p=481, n=true, awe=true
Server: Paper git-Paper-119 (MC: 1.17.1)
State: online=true, bungee=true
------------------------------
Vault 1.7.3-b131 (ENABLED)
FastAsyncWorldEdit 1.17-63;ca1744a (WRONG-VERSION)
WorldGuard 7.0.6-beta1+0b66f3e (ENABLED)
FastAsyncWorldEdit 1.17-63;ca1744a (ENABLED)
Multiverse-Core 4.3.0-b846 (ENABLED)
Multiverse-NetherPortals 4.2.1-b786 (ENABLED)

and

Name: uSkyBlock
Version: 2.9.0-SNAPSHOT
Description: Ultimate SkyBlock v2.9.0-SNAPSHOT-a0b10e5
Language: en (en)
State: d=128, r=48, i=459, p=492, n=true, awe=true
Server: Paper git-Paper-780 (MC: 1.16.5)
State: online=true, bungee=true
------------------------------
Vault 1.7.3-b131 (ENABLED)
FastAsyncWorldEdit 1.16-734;78acb85 (WRONG-VERSION)
WorldGuard 7.0.5+3827266 (ENABLED)
FastAsyncWorldEdit 1.16-734;78acb85 (ENABLED)
Multiverse-Core 4.3.0-b846 (ENABLED)
Multiverse-NetherPortals 4.2.1-b786 (ENABLED)

What steps will reproduce the problem?

  1. Set spawn-limits.enabled to false in config.yml; restart server
  2. Create a large aquarium, full island 96x96 dimensions with any wall, all blocks are water source blocks.
  3. Cover with prismarine roof, set biome to deep_ocean; leave, come back, confirm biome is effective (island wide)
  4. Observe squids, dolphins spawning, never any guardians.
  5. Set spawn-limits.enabled to true in config.yml; restart server
  6. remove all mobs, observe guardians spawning as expected.

We had been trying to avoid adding spawn limits, so hadn't turned the option on.
After isolation for other plugins, servers, config elements, changing this config item is consistent.

Our workaround is to enable limits, with a fairly high threshold. So, impact is low once we know the cause.

With limits disabled, I'm pretty sure we're not getting past SpawnEvents.java:onCreatureSpawn call to checkLimits. That, in turn, is likely canceling based on call to LimitLogic.java:canSpawn. canSpawn focuses on maximums, which (probably) aren't relevant if limits aren't enabled. Maybe just a first test in canSpawn if limits config is enabled?

@Muspah
Copy link
Member

Muspah commented Aug 12, 2021

You're absolutely right, thanks very much for investigating this! The SpawnEvents class isn't even initiated when limits are disabled:

https://github.com/uskyblock/uSkyBlock/blob/master/uSkyBlock-Core/src/main/java/us/talabrek/ultimateskyblock/uSkyBlock.java#L310

Should be an easy fix.

@Muspah
Copy link
Member

Muspah commented Aug 12, 2021

Do need to add some condition tho, because guardians will keep spawning otherwise:

image

@waseric
Copy link
Author

waseric commented Aug 14, 2021

Perhaps just make it just be a chance that it will spawn a guardian instead of the original watermob (once conditions are met). It could even be a fairly low chance. (e.g.: 5-20%). At the rate water mobs spawn, this would still create a decent chance. It might be somewhat closer to vanilla survival, too...

@Muspah
Copy link
Member

Muspah commented Aug 14, 2021

Did some testing tonight with probability, but I'm not sure about the right approach here.

If we alter the spawning of guardians to spawn with a 0.2 chance, the server will stop spawning guardians when there is enough "regular" fish in the water. Some fish has to be killed then to restart the guardian spawning process. I'm unsure if that's what we want, especially on most of the servers with spawn-limits enabled.

We could always cancel the spawn event, even when the fish isn't replaced with a guardian. That does lower the speed at which guardians spawn obviously, but still leads to a huge amount of guardians after a few minutes.

It would be an option to always cancel the spawn event when limits are enabled, and don't when disabled. But I don't think that would be a good solution, is it?

I could create a test build if you prefer btw.

@waseric
Copy link
Author

waseric commented Aug 15, 2021

The description for the deep ocean biome says that passive mobs will not spawn. Hostile mobs (including Guardians) will spawn normally.

While, of course, the behavior can change, and the documentation could be updated, I think the "documented" behavior supports the idea that we always cancel. It WILL still result in a large number of guardians over time, but really, if the operator is choosing to not set limits, they're saying that's ok.

The wiki for the guardian lists a 95% spawn failure rate in a number of conditions. I would be completely comfortable with a 95% failure rate (.05 probability). Even then, that's still giving excellent chances given the normal spawn rate of water mobs. It just slows things down a little bit.

@Muspah
Copy link
Member

Muspah commented Aug 15, 2021

Lets go with cancelling all the events then. My biggest concern is that users will start altering these settings without checking, and start complaining then.

Default failure rate of 95% sounds reasonable, but that seems like a good setting to add to the config.yml. Not that hard too. And a good place to add a warning that it might flood the server with guardians when spawn-limits are disabled.

Will update the PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants