Skip to content

Expose access to BlockEntity component.custom_data.PublicBukkitValues data #12298

@ens-gijs

Description

@ens-gijs

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

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions