I built a town in Minecraft, and I want to add a currency system. I know you can test for exactly a certain number with /execute; however, it's very annoying to have to sort out EXACTLY the amount needed to buy something. So my question: Is there a way to test for 3 or more of an item? Like, if you're holding 64 currency and the item you're buying costs 3?


1 Answer 1


What i would do is use some form of container for a player to put the currency into and then use a repeating command block with always active on and then put in the command

replaceitem blocks <pos:x y z> slot.container <container slot number> currency 3

Then put a chain command block in front of the arrow on the repeating command block and set it to: conditional then put in the command

replaceitem @p <slot number> 61

And just have a whole set of command blocks that just give back however much they put in - however much it costs = result, or just use a villager to sell stuff to people but by giving it custom trades look to the wiki for this or use xp as currency and again look at the wiki for this one as well

  • Those two commands don't even work. I also don't know what you're trying to accomplish with them, they surely do not count items. Oct 3, 2019 at 11:59
  • 1
    They don't count them, but they replace the incorrect number of currency with the correct amount and gives back the amount they had minus the correct amount of currency Oct 3, 2019 at 14:46
  • 1
    The commands work i've used them idk how many times Oct 3, 2019 at 14:47
  • Certainly not. Both "/replaceitem blocks" and "replaceitem @p" are not the beginning of any valid command. Oct 3, 2019 at 14:53
  • 1
    Yes it is, i've done it god knows how many times Oct 3, 2019 at 15:38

Not the answer you're looking for? Browse other questions tagged .