Paper icon indicating copy to clipboard operation
Paper copied to clipboard

ItemMeta CanPlaceOn and CanDestroy lose block state/tile state info

Open Machine-Maker opened this issue 4 years ago • 0 comments

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

Machine-Maker avatar Oct 05 '21 00:10 Machine-Maker