Mojira Archive
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).