Paper
Paper copied to clipboard
Fix CraftPersistentDataTypeRegistry CME
New approach to https://github.com/PaperMC/Paper/pull/6701. This will have no performance impact after adapters are created.
Is accessing this api async something we want to encourage? Especially if we move away from having our own itemstack implementation I am not sure how safe doing any of this would be even.
Well we definitely want to support creating and manipulating itemstacks on other threads. Specifically itemstacks that don't have an in-world representation (aren't in an inventory or container, or entity). You have to be more specific when you say "access this api async". Do you mean have the same instance of ItemStack on two threads, both making modifications? Or do you mean creating and manipulating a single ItemStack instance all in one thread that is NOT the main thread.
Would also agree. While the item stack itself does not have to be thread safe as an instance itself (e.g. I don't think we need to promote editing item stacks on multiple threads) we should still allow item stack creation and their customization off the main thread if that thread owns the item stack instance and no other (including main thread) mutates the item.
Closing this because a fix was already merged (in the PR you mentioned).