PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.7k stars 2.27k forks source link

Mob Switch - Mobs not prohibiting spawning of other mobs #8467

Open 0x80004005 opened 1 year ago

0x80004005 commented 1 year ago

Expected behavior

Mob switches are a construct that allows players to conditionally limit the natural spawning of new types of mobs in the world. When activated, the mob switch prevents new mobs from spawning. When deactivated, normal mob spawning occurs. The mechanisms are well documented in the community, but the basic mechanics are to create a large number of mobs of the needed type in a single chunk, manipulate them so that they will not despawn, and then to force that chunk to stay loaded while you wish mob spawning disabled.

There are several types of mob switches I built and tested on PaperMC that did not behave as expected:

  1. Silverfish Spawner Mob Switch
  2. Warden Mob Switch
  3. Zombie Villager Mob Switch
  4. Shulker Mob Switch

The expected behavior for any of these mob switches, is that assuming a single player is on the server, and 70+ mobs are spawned by the mob switch and those chunks remain loaded via chunk loader then no other mobs should spawn via natural spawning rules.

Observed/Actual behavior

Each of the mob switches built did not prohibit the spawning of other mobs while active. The expected behavior with a mob switch running would be that no other mobs should spawn in the world as per normal conditions however mobs continued to spawn. Even with WELL over 70 mobs spawned in the mob switch.

I will also add that in my testing world the paper jar was swapped for spigot, and the mob switches immediately worked in suppressing mob spawning. Switching the server jar back/forth would show working/not working behaviors

Steps/models to reproduce

Build any of the desired mob switches:

  1. Silver fish spawner - https://www.youtube.com/watch?v=EDBesTQW9XM

  2. Warden - https://www.youtube.com/watch?v=8ty3HE3Vg8U

  3. Zombie Villager - 70+ villagers that you have traded with, then zombified

  4. Shulker mob switch - did not buid/test as I didnt want to build with spawn eggs in case spawn tagging for those mobs is done differently by paper

  5. Keep the area loaded via chunk loader such that the mob switch chunk is a lazy chunk - https://www.youtube.com/watch?v=dJdEo2QKmzA

Plugin and Datapack List

AntiPopup/ bStats/ Chunky/ CoreProtect/ CustomTab/ DecentHolograms/ DiscordSRV/ dynmap/ Essentials/ GriefDefender/ GriefPreventionData/ Harbor/ InventoryRollbackPlus/ JoinCommands/ LastLoginAPI/ LuckPerms/ OpenInv/ OreAnnouncer/ Orebfuscator/ PlaceholderAPI/ Plan/ PlayerHeads/ PluginMetrics/ ProtocolLib/ Shopkeepers/ spark/ SuperVanish/ Tablist/

Paper version

This server is running Paper version git-Paper-210 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: 0bdf997) You are running the latest version Previous version: git-Paper-201 (MC: 1.19.2)

Other

Configs:

Paper-global.yml: https://pastebin.com/G7tHnjee Paper-world-default.yml: https://pastebin.com/fKyz3N2C

Was suggested to submit report: https://discord.com/channels/289587909051416579/289587909051416579/1029444287231963297

Phoenix616 commented 1 year ago

Please try setting the spawning.per-player-mob-spawns option to false in your world config. That option is there to fix multiplayer spawning in a way to make it more in-line with what one would expect on single player (done by making the mob limit per player/region not globally so that every player can get a similar amount of mobs). It's very likely that your behaviour change is due to that fix.

reisalex commented 1 year ago

I am having the same issue on my server. I'm on Paper-215 (MC: 1.19.2). I also just tried setting spawning.per-player-mob-spawns to false, but the mob cap is still not enforced with name tagged zombie villagers (other mobs are still spawning).

Rektroth commented 1 year ago

I am having the same issue on my server. I'm on Paper-215 (MC: 1.19.2). I also just tried setting spawning.per-player-mob-spawns to false, but the mob cap is still not enforced with name tagged zombie villagers (other mobs are still spawning).

Name-tagged mobs do not count toward the mob cap. This is expected behavior.

reisalex commented 1 year ago

OK just circling back. I now have 70 traded-with zombie villagers and there appear to be a number more other mobs still spawning around (although noticeably less than before, so the mob cap is working to an extent). @Phoenix616 comment above that spawning.per-player-mob-spawns might need to be set to false -- is that true? I would rather keep per-player-mob-spawns on for my multiplayer server...

Rektroth commented 1 year ago

OK just circling back. I now have 70 traded-with zombie villagers and there appear to be a number more other mobs still spawning around (although noticeably less than before, so the mob cap is working to an extent).

Mobs do not count toward the mob cap if they:

And this is all vanilla behavior - not Paper. If you want to make a mob switch, I suggest looking at a warden-based one.

reisalex commented 1 year ago

I guess I assumed The original post here has count-all-mobs-for-spawning: true, which I have been told should be ALL mobs (or most?). I have this set to true, and historically (paper 1.18) it had worked with zombie villagers that were traded with.

Rektroth commented 1 year ago

I guess I assumed the original post was referring to the setting count-all-mobs-for-spawning: true, which I have been told should be ALL mobs (or most?). I have this set to true, and historically (paper 1.18) it had worked with zombie villagers that were traded with.

It looks like zombie villagers do count toward the cap in vanilla, but it is unintentional (MC-182304). Perhaps there is a patch in Paper? In which case it could be inadvertently overriding the count-all-mobs-for-spawning setting.

0x80004005 commented 1 year ago

And this is all vanilla behavior - not Paper. If you want to make a mob switch, I suggest looking at a warden-based one.

Part of my testing methodology prior to posting included building a warden based mob switch. To your point, was trying various types of mobs to see if it impacted behavior. In my testing the warden based mob switch did not prohibit other mobs from spawning. I can build a testing world on paper with these various farms if you'd like to make testing this/reviewing it easier, if that's something that would be helpful.

Similar to @reisalex I would prefer not enabling spawning.per-player-mob-spawns to false as 1.18 introduced the per-player mob spawning if I'm not mistaken and its functionality I would like to keep.

0x80004005 commented 1 year ago

mis-click on submission, sorry about that

Insurexion commented 1 year ago

any update on this ? the behavior is still in effect to this date, from my experiments i have deduced it comes from the per player mob cap not allowing for vanilla setting :

best would be to have a 3rd setting, a "default" setting to keep per player mob cap on post 1.18 vanilla standard while retaining remotely loaded mob switches fonctionnality

Phoenix616 commented 1 year ago

Are you saying that disabling Paper's per-player-mobspawning doesn't make it behave like Vanilla? Because I feel like if that's the case then the best would be fixing that, not adding a third mode.

electronicboy commented 1 year ago

I think mojang added a bunch of logic in the same place as we did, and there was a general "we're leading to the same behavior here"; I would try to see if reverting the patch resolves the issue here, I have doubts that it would but, no idea; No hardware to test this myself

Insurexion commented 1 year ago

Are you saying that disabling Paper's per-player-mobspawning doesn't make it behave like Vanilla? Because I feel like if that's the case then the best would be fixing that, not adding a third mode.

Yes i am saying exactly that, and i would tend to agree, if this could be fix i don't see what would be the need to keep the outdated pre 1.18 spawn mechanics. But i've been told on the discord it's more trouble than it's worth to fix : s

Insurexion commented 1 year ago

i smell a check for server wide mob cap missing in the code when beggining a spawning cycle but that's just an instinct

Insurexion commented 1 year ago

idk i have no clue what's the exact difference between paper per player mob spawning and mojang per player mob spawning, i just know yours was first and you didn't update it when mojang got theirs (got that info from staff member on discord) and somehow this difference is enough to stop remotely loaded mob switches from preventing spawning in a dimension