PreCreatureSpawnEvent fires before vanilla placement checks in isValidSpawnPostitionForType, inflating per-player mobBackoffCounts in air/water
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Start in NaturalSpawner.isValidSpawnPostitionForType and trace how its return status reaches spawnCategoryForPosition and updateFailurePlayerMobTypeMap. Check the existing placement checks and PreCreatureSpawnEvent call order, then run the relevant spawning tests. Done means the event fires only after placement checks pass and invalid coordinates do not inflate player mob backoff counts.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected behavior
In NaturalSpawner.isValidSpawnPostitionForType, PreCreatureSpawnEvent should only be called after the vanilla placement checks (SpawnPlacements.isSpawnPositionOk, SpawnPlacements.checkSpawnRules, level.noCollision) succeed, so that impossible mid-air/water coordinates return PreSpawnStatus.FAIL instead of triggering plugin cancellations and inflating mobBackoffCounts via updateFailurePlayerMobTypeMap.
Observed/Actual behavior
In NaturalSpawner.isValidSpawnPostitionForType (lines 387–406), PreCreatureSpawnEvent is fired at the very start of the method, before SpawnPlacements.isSpawnPositionOk, SpawnPlacements.checkSpawnRules, and level.noCollision:
NaturalSpawner.getRandomPosWithinpicks a random(x, y, z)betweenminYand the highest block in the chunk.isValidSpawnPostitionForTypeimmediately firesPreCreatureSpawnEventeven ifposis mid-air (void) or water where the chosen mob could never spawn.- When a plugin (such as WorldGuard with
regions.use-pre-creature-spawn-event: trueandmob-spawning: deny) cancels the event,isValidSpawnPostitionForTypereturnsPreSpawnStatus.CANCELLED. NaturalSpawner.spawnCategoryForPosition(line 303) then callschunkMap.updateFailurePlayerMobTypeMap, incrementingServerPlayer.mobBackoffCountsfor every random mid-air/water hit.- As a result,
/paper playermobcapsimmediately maxes out (e.g.70/70monsters with0actual monsters in the world) and completely starves natural spawning in valid areas above/outside the region.
Moving the PreCreatureSpawnEvent call to the end of isValidSpawnPostitionForType (after the boolean placement checks pass) still avoids entity instantiation (getMobForSpawn / finalizeSpawn), avoids spamming plugins with thousands of mid-air events, and prevents false backoff inflation.
Steps/models to reproduce
- Start a Paper server with WorldGuard installed and set
regions.use-pre-creature-spawn-event: trueinplugins/WorldGuard/config.yml(WorldGuard had to disable this by default in 7.0.20 due to this exact issue, see EngineHub/WorldGuard#2314). - Create a flat water world (
/mv create waterworld normal -t FLAT -gs {"biome":"minecraft:ocean","layers":[{"block":"minecraft:water","height":128}]}) or a Skyblock/void world. - Create a WorldGuard region covering the water/air layer (
-200, -64, -200to200, 64, 200) withmob-spawning: deny. - Build a closed dark stone box above the region (e.g. from
-50, 70, -50to50, 100, 50) and stand near it. - Check
/paper playermobcaps: theMONSTERcap is permanently full viamobBackoffCountswith0real monsters, and almost nothing spawns in the dark box.
Plugin and Datapack List
Plugins (3): Multiverse-Core, WorldEdit, WorldGuard
Datapacks: vanilla, paper
Paper version
This server is running Paper version 26.3-248-main@0727243 (2026-11-10T11:35:52Z) (Implementing API version 26.3.build.248-stable)
You are running the latest version
Other
Related WorldGuard issue: https://github.com/EngineHub/WorldGuard/issues/2314
- Lingua principale
- Java
- Stelle
- 12.8k
- Fork
- 3.6k
- Merge medio
- 3g 7h
- PR unite (30g)
- 19
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PaperMC/Paper
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
Add .getIgniter() to ExplosiveMinecartForse già presa @WouterGritter l’ha presa 61 giorni fa. Apertastatus: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
PaperMC/Paper#14097 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
BlockType#isOccluding is incorrectly handledForse già presa @ryoji-ikeda l’ha presa 205 giorni fa. Apertastatus: accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
PaperMC/Paper#13790 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
status: needs triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 43/100
PaperMC/Paper#14492 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Checkstyle] Ignore check for javadocs into method-local classesForse già presa @Machine-Maker l’ha presa 2 giorni fa. Apertastatus: accepted
PaperMC/Paper#14490 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PaperMC/Paper
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
tchiotludo/akhq#3438 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
Paul-Austin-Oswego-CSC480-HCI521/gift-app#266 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
ome/bioformats#4509 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno