PaperMC / PaperMC/Paper

`World#spawnEntity` doesn't initialize passengers properly

Open
#13,559 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted version: 1.21.11
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

Spawned entity's passenger(s) are properly created/initialized by the server, added to the world and synchronized w/ nearby players.

Observed/Actual behavior

Looks like spawned entity's passenger(s) doesn't even exist on the server side until the chunk in which it spawned is reloaded (i.e. player teleported to different world and then, after ~ 10s, teleported back).

Steps/models to reproduce

Spawn a lots of spiders using the method

vWorld.spawnEntity(vLocation, EntityType.SPIDER, CreatureSpawnEvent.SpawnReason.NATURAL, (vEntity) -> {
	// it doesn't matter if anything is performed here, but in my case I'm using this method
});

Then, after 1 tick, call Entity#remove on all spawned entities if Entity#isEmpty() returns true.

If you're lucky, you will see a "partially frozen" spider (it produces sounds and you still can attack it, but it won't attack you even at night) w/o passenger (skeleton), but /data get entity ... shows that passenger exist, just not properly initialized/created (?).

Plugin and Datapack List

Only my test plugin. LuckPerms, WorldEdit, WorldGuard, CoreProtect and Grim AC.

datapack list
[21:37:27] There are 2 data pack(s) enabled: [vanilla (built-in)], [file/Bukkit (world)]
[21:37:27] There are no more data packs available

Paper version
This server is running Paper version 1.21.11-90-main@4b35f5c (2026-01-09T18:48:48Z) (Implementing API version 1.21.11-R0.1-SNAPSHOT)
You are 2 version(s) behind
Other

This issue present even on Paper 1.20.4.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the World#spawnEntity entry point and trace how passenger entities are initialized and added to the world. Reproduce the issue by spawning spiders with passengers, then calling Entity#remove after one tick when Entity#isEmpty() is true. Done means passengers exist server-side, are initialized, added to the world, and synchronized with nearby players without a chunk reload.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.