Fix entities with persist=false copied in an invalid state#2721
Fix entities with persist=false copied in an invalid state#2721me4502 merged 1 commit intoEngineHub:version/7.3.xfrom
Conversation
|
Thanks for this, does this issue also affect the other platforms? (NeoForge, Fabric, Sponge) |
|
I don't think they have the same persist flag, it was added by bukkit not mojang. |
|
my understanding of this is that it's fixing a wider bug, where the persist tag was basically one of the symptoms on Bukkit. given worldedit is a cross platform mod, generally if something is fixed/changed in one platform it's best to keep it consistently applied across all |
|
I'm a bit perplexed by the minecraft behavior here. the save method returns a bool, but still fills the tag in? doesn't this mean that if, for example, there's extra data on a leash entity, it will get lost after a save/load? does the leashed animal recreate a new one each time? |
|
Using fabric as a reference here just because I have it open: Minecraft calls saveSelfNbt and returns false if it's a passenger or if it's not allowed to save that entity type. WorldEdit instead calls a deeper function, writeNbt, fetching the entity type itself and checking if it's a passenger, but does not check if it's allowed to save the entity type. And yes the leashed animal creates the leash on spawn. |
18152fa to
4db029b
Compare
|
Applied patch to other targets. Sponge does not expose the correct function, so emulate it. |
4db029b to
4b12b6b
Compare
Remove a redundant passenger check, as entity.save() returns false in that case.
This also causes leash knots to not be copied. I don't think this is a problem because:
- They would not be saved to disk, it's misleading for users that they appear.
- Pasted leashed mobs still think they're leashed to the original position and get unleashed* - no change in behaviour.
\* Unless they're pasted close enough to the original position, in which case this has better behaviour because they create their own leash_knot entity.
4b12b6b to
1f8c3a7
Compare
Remove a redundant passenger check, as entity.save() returns false in that case.
This also causes leash knots to not be copied. I don't think this is a problem because:
* Unless they're pasted close enough to the original position, in which case this has better behaviour because they create their own leash_knot entity.
Fixes #2719