How can I delete 1 item in Minecraft?

Ly
9

I have a stack on the floor and I want to delete ONE item from it. My command: / execute positioned x y z run kill @e [type = minecraft: item, distance = .2, limit = 1]. This CMD kills the whole stack (despite limit = 1) I also tried / execute positioned xyz as @e [type = minecraft: item, distance = .2, limit = 1, sort = nearest] run kill @s, that also didn't work… Do you have a solution?

an

Kill is not possible because the whole stack counts as a single entity. Try a data merge:

/ execute as @e [type = minecraft: item, x = x, y = y, z = z, distance = .2, limit = 1, sort = nearest] run data merge entity @s {Item: {Count: 63b }}

gl

But you can do it all on

/ data merge entity @e [type = item, distance = .2, limit = 1] {Item: {Count: 63b}}

an

That's right, thank you!

Don't forget x, y, and z. He just wants to reduce a stack by 1 at a certain position.

/ data merge entity @e [type = item, x = deinX, y = deinY, z = deinZ, distance = .2, limit = 1] {Item: {Count: 63b}}

gl

But if you specify x y z, the command only merges the items that are exactly at coordinate x y z and then only if this coordinate is 2 blocks away from the CommandSender. This is how I would do it if coordinates are important:

/ execute at coordinates run data merge entity @e [type = item, distance = .2, limit = 1] {Item: {Count: 63b}}

gl

If you can program plugins, then I can help you.

Ly

I want without plugins…

Ly

Can I write it into a data merge that it should delete an item regardless of the number, or do I have to do 64 CMD blocks with if?

an

Recently there are functions, so you can simply make 64 such commands and combine them into one function. See here, that's exactly what you need: https://www.google.de/...craft_113/

gl

Then you have to do it as in MrAmazing2's answer…