PreCreatureSpawnEvent fires before vanilla placement checks in isValidSpawnPostitionForType, inflating per-player mobBackoffCounts in air/water
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Java
- スター
- 12.8k
- フォーク
- 3.6k
- 平均マージ
- 3日 7時間
- マージ済み PR(30日)
- 19
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PaperMC/Paper のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
Add .getIgniter() to ExplosiveMinecart対応中かも @WouterGritter が 61 日前に担当しました。 オープンstatus: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
PaperMC/Paper#14097 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
BlockType#isOccluding is incorrectly handled対応中かも @ryoji-ikeda が 205 日前に担当しました。 オープンstatus: accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
PaperMC/Paper#13790 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
status: needs triage
難易度 4/5 3〜5日 初心者へのやさしさ 43/100
PaperMC/Paper#14492 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Checkstyle] Ignore check for javadocs into method-local classes対応中かも @Machine-Maker が 2 日前に担当しました。 オープンstatus: accepted
PaperMC/Paper#14490 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
tchiotludo/akhq#3438 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Paul-Austin-Oswego-CSC480-HCI521/gift-app#266 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
ome/bioformats#4509 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信