mojira.dev
MC-44609

/clear Max Count removes less

I was making an Adventure map Concept where if you have 64 iron, you can turn them into 1 diamond. but if you have 63 diamonds, it works aswell, which isn't what I entered.
1st Command Block:

/clear @p iron_ingot 0 64

2nd Command Block (Which gets run if the first one succeed):

/give @p diamond

Command Log:
1st Command Block:

[@: Cleared the inventory of Nusia, removing 63 items]

2nd Command Block:

[@: Given [Diamond] * 1  to Nusia]

so the bug is that it cleared my 63, even that I entered 64 as Max Count.

Comments 4

The max count argument means it will clear up to 64 items. If you had two stacks of iron ingots and ran that command, only one would be removed. I don't think this is a bug.

Then Mayble add a "Min Count" argument to the command so shops could be possible to make 😛

I posted a suggestion for this on reddit [1] as well as an alternative [2] might be better in general.

I see four different ways Mojang could address this:
• Add a [minCount] argument to the /clear command
• Change [maxCount] to [count] to clear exact amounts
• Add a range spec in the form [min]..[max] instead of [maxCount]
• Add an inventory test to the player filters (@p, etc.)

The first three are mutually exclusive, while the fourth could be added with or without any of the first three.

I like ranges in general because they are more expressive:
• Want to clear up to 64 items? Use: `..64`.
• Want to clear all items as long as they have at least 64? Use: `64..`.
• Want to clear up to 64 items but only if they have at least 32? Use: `32..64`
• Want to clear all items? Use: `..`, or leave blank.
• Want to clear 64 items, but only if they have at least 64 items? Use: `64..64` or just `64`.

Range specs could theoretically be used for x/y/z coords as well instead of how 3D volumes are now specified for player/entity filters or the /clone and /fill commands in the current snapshots.

An inventory test would allow for map makers to test for special items to allow entry to new levels.

Sorry for usurping a bug comment for suggestions!

[1] http://reddit.com/r/minecraftsuggestions/comments/1uxz00/add_mincount_to_clear/
[2] http://reddit.com/r/minecraftsuggestions/comments/1tzptp/add_inventory_test_to_player_filter_in_commands/

Currently having the same problem

GamersForOne

(Unassigned)

Unconfirmed

redstone

Minecraft 14w02c

Retrieved