PreCreatureSpawnEvent fires before vanilla placement checks in isValidSpawnPostitionForType, inflating per-player mobBackoffCounts in air/water
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Java
- Star
- 12.8k
- Fork
- 3.6k
- Merge trung bình
- 3 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 19
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PaperMC/Paper
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add .getIgniter() to ExplosiveMinecartCó thể đã có người làm @WouterGritter đã nhận 61 ngày trước. Đang mởstatus: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
PaperMC/Paper#14097 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BlockType#isOccluding is incorrectly handledCó thể đã có người làm @ryoji-ikeda đã nhận 205 ngày trước. Đang mởstatus: accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
PaperMC/Paper#13790 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status: needs triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 43/100
PaperMC/Paper#14492 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Checkstyle] Ignore check for javadocs into method-local classesCó thể đã có người làm @Machine-Maker đã nhận 2 ngày trước. Đang mởstatus: accepted
PaperMC/Paper#14490 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PaperMC/Paper
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
tchiotludo/akhq#3438 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Paul-Austin-Oswego-CSC480-HCI521/gift-app#266 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
ome/bioformats#4509 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày