Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Fix CraftPersistentDataTypeRegistry CME

Open Gerrygames opened this issue 2 years ago • 3 comments

New approach to https://github.com/PaperMC/Paper/pull/6701. This will have no performance impact after adapters are created.

Gerrygames avatar Oct 01 '22 18:10 Gerrygames

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.

Owen1212055 avatar Dec 27 '22 21:12 Owen1212055

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.

Machine-Maker avatar Dec 28 '22 01:12 Machine-Maker

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.

lynxplay avatar Dec 28 '22 01:12 lynxplay

Closing this because a fix was already merged (in the PR you mentioned).

codebycam avatar Sep 04 '23 12:09 codebycam