Skip to content

Refactor entity name retrieval to use this.entity for off-owning-thread access#377

Closed
NonSwag wants to merge 1 commit intoPaperMC:ver/1.21.6from
NonSwag:name-off-owning-thread
Closed

Refactor entity name retrieval to use this.entity for off-owning-thread access#377
NonSwag wants to merge 1 commit intoPaperMC:ver/1.21.6from
NonSwag:name-off-owning-thread

Conversation

@NonSwag
Copy link
Copy Markdown

@NonSwag NonSwag commented Jun 29, 2025

This allows to get an entity's (team) name without having to switch thread context

@Dueris
Copy link
Copy Markdown

Dueris commented Apr 14, 2026

Doesn't getName tho in CraftEntity(and other methods) access the getCustomName method in Entity, which accesses the synched entity data? IIRC, that's not safe

(Yes I know this is really old Im very sorry, I was looking at this code earlier and remembered this PR and wanted to throw in my thought)

@NonSwag
Copy link
Copy Markdown
Author

NonSwag commented Apr 14, 2026

I think I checked all places where these methods are called but I can't really remember anymore.
I think this PR can be closed to be honest.

@Dueris
Copy link
Copy Markdown

Dueris commented Apr 14, 2026

It's not abt where the methods in the API are called, it's that it's accessing a system internally that isn't thread safe and is used for a lot of different states, so making it unguarded isn't the best idea bc then if people start accessing the internal synched entity data off the region context then it can cause crashes easily that make no sense(Ive seen a few before)

@Dueris
Copy link
Copy Markdown

Dueris commented Apr 14, 2026

So yea probably should be closed maybe

Sorry man, I remembered this PR and wanted to throw my thought in

@NonSwag NonSwag closed this Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants