1

Just started playing Minecraft Windows 10 edition, and I'm having a lot of fun playing around with command blocks. I'm trying to build a store in which you trade 64 Rotten Flesh for 1 diamond. I've got most of it set up, however, whether I have 1 or 63 blocks, they all get removed and I still get the diamond.

How to I set it up so that ONLY if I have a stack or a total of 64 I would receive the item?

My commands are as follow :

First CB:

/clear @p emerald 0 1

followed by chains

/testforblock 65 63 65 powered_comparator > /give @p diamond 1 > /msg @p "Message" > /title @p actionbar purchase successful

Second row if player doesn't have an item or enough of it:

/testforblock 65 63 65 unpowered_comparator > /msg @p "Message" > /title @p actionbar Purchase Failed.
3
  • You're testing for a powered/unpowered comparator? Why? Why not just use conditional command blocks? Commented Aug 30, 2017 at 6:30
  • What container are you using? How do you remove the items from that container?
    – Starcaz
    Commented Aug 30, 2017 at 8:34
  • So, let's say I wanted to make it so that you trade 64 Rotten_Flesh for 1 diamond, how would I go about doing that? I've been doing a lot of research and watching videos, but nothing seems to do exactly what I want it to. PS: I'm on the Windows 10 Edition of Minecraft
    – Georgie Q
    Commented Aug 30, 2017 at 19:23

2 Answers 2

-2

/summon villager ~ ~ ~ {Invulnerable:1b,NoAI:1b,CareerLevel:1,Willing:1b,Offers:{Recipes:[{rewardExp:1b,buy:{id:"minecraft:rotten_flesh",Count:64b},sell:{id:"minecraft:diamond",Count:1b}}]}}

That should solve all you problems. It summons a Villager that trades 64 rotten_flesh for 1 diamond. It has no AI so it wont move around and is invulnerable so it won't die.

1
  • 1
    As of now, MCBE (which windows 10 edition is a part of) does not support data tags. However, it would be possible through an addon.
    – Matth3w 23
    Commented Apr 23, 2018 at 16:49
-2

The first in this here normal Command Block
/clear @p rotten_flesh 63
Green Command Block, and change the second command to test if the first command was executed
/clear @p rotten_flesh 1 And then another green Command Block with the second command tested if command executed successfully /give @p diamond 1

It takes 63 Rotten Flesh and then if you don't have 1 Rotten Flesh it won't give you a Diamond, but if you have less it's just going to take it, and it won't give you anything.
You can maybe do something so that it gives the items back if they weren't all given.

1
  • I made some edits to your post, but don't understand some of the things you wrote. Can you edit it yourself (and put a little bit more effort into it the next time :)?
    – Joachim
    Commented Apr 10, 2020 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.