PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
10.04k stars 2.34k forks source link

EntityAddToWorld/EntityRemoveFromWorld fired incorrectly in some cases #9581

Open Boy0000 opened 1 year ago

Boy0000 commented 1 year ago

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

Machine-Maker commented 1 year ago

I can confirm this behavior. I had to restart the server after spawning the entity, but I could the add/remove/add behavior when I joined and caused the chunks to load.

EDIT: I added "unlikely" to this, as fixing it is a larger change that would have other ramifications. I would expect this not to be fixed for a while.