Expose access to BlockEntity component.custom_data.PublicBukkitValues data
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?
The PDC set on an ItemStack which results in a BlockEntity when placed (ex. shulker box) is preserved in the BlockEntity in components.custom_data.PublicBukkitValues. I would like to be able to access those values from the Block object after the ItemStack is placed. There is currently no way to do this.
Getting / setting PDC values on block.getState() instanceof TileState tileState uses PublicBukkitValues in the BlockEntity NBT for storage leaving the values in components.custom_data.PublicBukkitValues inaccessible.
Describe the solution you'd like.
I'd propose to simply change where TileState accesses and stores its PDC data. Instead of storing at the NBT root of simply PublicBukkitValues, use the BlockEntity's component storage at components.custom_data.PublicBukkitValues.
I understand this may result in unexpected or backwards incompatible behavior, it may prove difficult to deal with existing blocks that have both the old and new storage locations, and a multitude of other challenges may exist. In which case please consider adding an additional method on TileState to retrieve the BlockEntites component stored PDC data, something like PersistentDataContainer getBlockEntityPersistentDataContainer(); (or choose a better semantic name ;).
Describe alternatives you've considered.
Dealing with the hell of trying to capture ItemStack PDC into TileState PDC then restore TileState PDC values during the item->block->item lifecycle.
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 tracing TileState access from Block#getState and compare its current root PublicBukkitValues storage with the BlockEntity components.custom_data.PublicBukkitValues path described here. Done means an agreed API and storage behavior lets callers access the preserved ItemStack data while addressing compatibility for blocks containing either or both locations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100