Skip to content

ItemMeta CanPlaceOn and CanDestroy lose block state/tile state info #6719

@Machine-Maker

Description

@Machine-Maker

Expected behavior

The CanPlaceOn and CanDestroy NBT values on itemstacks support more than just material keys, or material tag keys, they also support block state (mojangs name)/block data (bukkits name) and tile state info. Like minecraft:chest[waterlogged=true]{Contents:...}. That extra block info should be preserved.

Observed/Actual behavior

When an itemstack goes through the nms -> bukkit -> nms path, that extra block data is lost.

Steps/models to reproduce

  1. Place 4 chests, each facing a different direction
  2. Enter Adventure mode
  3. Give your self one of these
    1. /minecraft:give @s minecraft:diamond_pickaxe{CanDestroy:["minecraft:chest[facing=north]"]}
    2. Don't move it in your inventory
  4. Try to break each of the chests, you can only break the one facing north (correct behavior).
  5. Move the pick to a different slot in your hotbar
  6. You can now break any of the chests

Verify with /paper dumpitem that the pickaxe has lost the extra [facing=north] bit.

Plugin and Datapack List

None

Paper version

1.17.1 304

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.type: bugSomething doesn't work as it was intended to.version: 1.18Game version 1.18

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions