/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
- Summon or place a normal chest minecart
- 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).
Created Issue:
/replaceitem and Chest Minecarts
When using /replaceitem entity on a MinecartChest entity, the command fails as shown in the picture, telling you that it could not replace the container slot with the specified item (and also starts with "Usage: " which shouldn't be there)
How to reproduce:
- Summon or place a normal MinecartChest entity
- Run the following command while standing fairly close to the minecart:
/replaceitem entity @e[r=5,type=MinecartChest] slot.container.0 minecraft:dirt
is duplicated by
/replaceitemandChest Minecarts/replaceitem doesn't work with Chest Minecarts
is duplicated by
When using /replaceitem entity on a MinecartChest entity, the command fails as shown in the picture, telling you that it could not replace the container slot with the specified item (and also starts with "Usage: " which shouldn't be there)
How to reproduce:
- Summon or place a normal MinecartChest entity
- Run the following command while standing fairly close to the minecart:
/replaceitem entity @e[r=5,type=MinecartChest] slot.container.0 minecraft:dirtWhen using /replaceitem entity on a MinecartChest entity, the command fails as shown in the picture, telling you that it could not replace the container slot with the specified item (and also starts with "Usage: " which shouldn't be there)
How to reproduce:
- Summon or place a normal MinecartChest entity
- Run the following command while standing fairly close to the minecart:
/replaceitem entity @e[r=5,type=chest_minecart] slot.container.0 minecraft:dirt
When using /replaceitem entity on a
MinecartChest entity, the command fails as shown in the picture, telling you that it could not replace the container slot with the specified item(and also starts with "Usage: " which shouldn't be there)How to reproduce:
- Summon or place a normal
MinecartChest entity- Run the following command while standing fairly close to the minecart
:
/replaceitem entity @e[r=5,type=chest_minecart] slot.container.0 minecraft:dirtThe bug
When using /replaceitem entity on a chest 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
- Summon or place a normal chest minecart
- Run the following command while standing fairly close to the minecart
/replaceitem entity @e[r=5,type=chest_minecart] slot.container.0 minecraft:dirtCode analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
Chest minecarts do not override the method net.minecraft.entity.Entity.replaceItemInInventory(int, ItemStack).
/replaceitem doesn't work withChestMinecarts/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
- Summon or place a normal chest minecart
- Run the following command while standing fairly close to the minecart
/replaceitem entity @e[r=5,type=chest_minecart] slot.container.0 minecraft:dirtCode 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).
Confirmed for 18w19a
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
- Summon or place a normal chest minecart
- Run the following command while standing fairly close to the minecart
/replaceitem entity @e[r=5,type=chest_minecart]slot.container.0 minecraft:dirtCode 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).
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
- Summon or place a normal chest minecart
- Run the following command while standing fairly close to the minecart
/replaceitem entity @e[distance=..5,type=minecraft:chest_minecart] container.0 minecraft:dirtCode 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).
thanks @Kumasasa
{~Nethonos], your ticket!
Duplicate of MC-59729


Confirmed.
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.
Still present in 1.8.7.
Still present in 1.8.9 AND snapshot 15w51b. Could this one be fixed please ?
Present in 16w04a.
Yep, it's still here in 1.9.2. It's going to force me to create thousands of command blocks if we can't fix it. Please take a look at it and see what you can do.
Confirmed for 16w42a
Confirmed for 1.11.2
Confirmed for 1.12
Confirmed for 1.12.2
Please fix this issue quickly!
Fixing this issue would give us a lot of possibilities.
It's now impossible to clear just one slot of a chest minecart or just replace one of it's slots.
using entitydata to set the items actually clears the entire inventory of the chest minecart.
This is fine for me. I can wear those with ease.
Confirmed for 17w50a
Confirmed for 18w01a
Error:
The target does not have the specified slot
for command:
/replaceitem entity @e[type=chest_minecart,distance=..5] container.0 minecraft:dirt
one way to achieve the same:
{ Slot:0b,id:"minecraft:dirt",Count:1b}/data merge entity @e[type=chest_minecart,limit=1,distance=..5] {Items:[
]}
1. Don’t edit your comment over and over again, use the preview button.
2. That’s not a suitable workaround, as that will remove the inventory it already had.
Confirmed for 18w16a
Well this would be the best workaround for that bugg
*
execute as @e[type=minecraft:chest_minecart,limit=1,nbt=!{Items:[{Slot: 0b}]}] run data merge entity @s {Items:[{Slot:0b,id:"minecraft:dirt",Count:1b}]}*
That’ll clear the whole inventory.
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.