mojira.dev
MC-257133

Desync when placing large paintings with NBT on a small space

The bug

When placing a painting with NBT in survival mode if the space you're trying to place it on is too small the painting will disappear from your inventory. You can get it back by either clicking on the slot in your inventory or reloading the world

To reproduce

  1. Give yourself a painting item with NBT:

    /give @p painting[entity_data={id:"minecraft:painting",variant:"minecraft:creebet"}] 1
  1. Try to place it on a block.

Observed result

The item "disappears" from the inventory, reappearing when the slot is clicked from the inventory.

Expected result

The placement would fail completely.

Code analysis (as of 24w18a)

Through the use of Spongepowered Mixins, I was able to come up with a fix, and that is to move line 75 (the "remove 1 from stack" line) of HangingEntityItem.java up a couple of lines into the "if is not client" code block where the placement sound is played

Linked issues

Attachments

Comments 4

Confirmed in 1.19.4 pre-release 3.

Said the item would disappear with item, although I have proof (cant find it though), it's worked on trees barriers, heck, on grass. I am in 23w51b right now as we speak. And it's multiplayer (lan -id/port: 2014).

Fixed in 25w03a along with the entity variant component changes

MincraftEinstein

(Unassigned)

Confirmed

Platform

Normal

Items, Networking

1.19.2, 22w44a, 22w45a, 22w46a, 1.19.3, ..., 1.21.2, 24w44a, 1.21.3, 1.21.4, 25w02a

25w03a

Retrieved