mojira.dev
MC-59729

/replaceitem doesn't work with chest or hopper minecarts

The bug

When using /replaceitem entity on a chest or hopper minecart, the command fails as shown in the picture, telling you that it could not replace the container slot with the specified item.

How to reproduce

  1. Summon or place a normal chest minecart

  2. Run the following command while standing fairly close to the minecart

    /replaceitem entity @e[distance=..5,type=minecraft:chest_minecart] container.0 minecraft:dirt

Code analysis

Based on 1.11.2 decompiled using MCP 9.35 rc1

Chest and hopper minecarts do not override the method net.minecraft.entity.Entity.replaceItemInInventory(int, ItemStack).

Linked issues

Attachments

Comments 25

Confirmed for 14w33a. I'll need to pause my entire project because of this.

That's why I posted this, I realized it and had to stop the project that you can see in the background of the picture for the moment.

Confirmed for latest snapshots and 1.8-pre1.

Confirmed for latest pre-releases and 1.8.

15 more comments

Well it doesn't i swear you dont even tried because i use it in a datapack and it works ^^

But if you think it Clears the Inventory tell me why?
There is no reason why the whole Inventory should be cleared
after this command because i just Modify Slot:0b (the first slot)

/data merge with lists always clears the list; there's one exception, and that's the villager inventory (which is a separate bug).
And I just checked.

You're right i tried it on a World where i have a datapack that fills the chests permanently thats why i dont had empty chests after merging something

 confirmed for 18w22a

I'm still having this problem on bedrock edition.

DonkeyCore

Nethonos

boq

Confirmed

container, containers, hopper-minecart, minecartwithchest, replaceitem

Minecraft 14w26c, Minecraft 14w33a, Minecraft 1.8-pre1, Minecraft 1.8, Minecraft 1.8.7, ..., Minecraft 1.13-pre5, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9

Minecraft 1.13-pre10

Retrieved