Add a PersistentDataType<ItemStack> or PersistentDataType<NativeNBTObject>
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem?
My idea is to be able to save ItemStacks in PDCs, or any type of NBT object native to Minecraft, such as Entities, TileEntities, or other native Minecraft NBT objects that aren't huge (like a Chunk or a World).
The problem is, if we want to put an ItemStack in a PDC, we have to create our PersistentDataType, okay, but when we have to save the components, it's immediately hellish. We have to create a PersistentDataType for each component, while behind it, it's all NBTs.
The same goes for if we want to put an Entity in a PDC; saving all the important data for each entity type in a PersistentDataContainer quickly becomes unmanageable.
Describe the solution you'd like.
Add a PersistentDataType for Entity, ItemStack and TileState. This way we could do:
container.set(key, PersistentDataType.ITEMSTACK, item);
container.set(key, PersistentDataType.ENTITY, entity);
container.set(key, PersistentDataType.TILESTATE, tileState);
Describe alternatives you've considered.
Add an asPersistentDataContainer function for Entity, ItemStack and TileState, for the others I don't see any use, but why not for some. And this function would return a PersistentDataContainerView. In this way we could do:
container.set(key, PersistentDataType.TAG_CONTAINER, item.asPersistentDataContainer());
Other
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the PersistentDataType and PersistentDataContainer API entry points and how ItemStack, Entity, and TileState data is currently represented. Done would require a decided, supported approach for storing the requested native Minecraft objects without requiring users to define component types themselves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100