mojira.dev
MC-175964

Setblock command run by book in lectern to clear inventory run in command block causes ghost items

When calling setblock from a book (in a lectern or in hand), the block will be set. If a commandblock executing the clear command is being executed by that, ghost items are created only if the book was in a lactern, but not otherwise.

 

How to reproduce

Preparation

Execute these two commands (if necessary, using a commandblock) to get the lectern and the command block:

Lectern:

/give @p lectern{BlockStateTag:{has_book:"true"},BlockEntityTag:{Book:{id:written_book,Count:1b,tag:{author:"Summoner",title:"Summoned Book",pages:['{"text":"Set Redstone Block","clickEvent":{"action":"run_command","value":"/setblock ~3 ~ ~ redstone_block"}}']}}}}

Command-Block:

/give @p command_block{BlockEntityTag:{Command:"clear @p"}}

Stand still. Place the commandblock to the east so that there are 3 spaces between you and the commandblock. (~4 ~ ~) Place the lectern to the east right next to you. (~1 ~ ~)

Execution

Click on the lectern, click the text, the redstoneblock will appear, the commandblock's output will tell you "Removed 2 items from player" and you'll have ghost-items in your toolbar.
Re-Setup.
Take the book from the lectern, open it while in your toolbar, click the text, the redstoneblock will appear, the commandblock's output will tell you "Removed 2 items from player" and your items will be gone without leaving ghost-items.

 

This bug seems to be in correlation with MC-154094.

Linked issues

Comments 0

No comments.

ChaosNe0

boq

Confirmed

Commands

1.15.2, 1.16.1, 1.16.2 Pre-release 3

21w10a

Retrieved