PaperMC / PaperMC/Paper

Entity added/removed/re-added in quick succession redundantly in some cases

Open
#9,581 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected behavior

When an entity is added EntityAddToWorld should fire once and EntityRemoveFromWorld should not fire

Observed/Actual behavior

When specific entities are loaded it will first call EntityAddToWorldEvent, then EntityRemoveFromWorldEvent and again EntityAddToWorldEvent for the same entity

Steps/models to reproduce

Easiest way I could reproduce it is simply spawning an entity and rejoining
Summoning it initially has no issues
But when rejoining it triggers the event like shown below

https://github.com/PaperMC/Paper/assets/62521371/6438bc6c-b7b1-4c2d-ad3a-9ff36e0d2fb0

Plugin and Datapack List

[00:50:29 INFO]: Server Plugins (1):
[00:50:29 INFO]: Paper Plugins:
[00:50:29 INFO]: - untitled1

version
[00:50:31 INFO]: Checking version, please wait...
[00:50:31 INFO]: This server is running Paper version git-Paper-103 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: 2c55dd8)
You are running the latest version

Paper version

[00:50:31 INFO]: Checking version, please wait...
[00:50:31 INFO]: This server is running Paper version git-Paper-103 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: 2c55dd8)
You are running the latest version

Other

untitled-plugin: image

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

The issue names no files or tests. Start by reproducing the entity spawn and rejoin flow, then trace the EntityAddToWorldEvent and EntityRemoveFromWorldEvent sequence; done when the rejoined entity emits only the expected add event.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.