2

I'm trying to make an AND (logic) gate in minecraft with command blocks in order to make some vanilla shops in my world. With the first input (A) I'm checking if there is at least one diamond in the inventory of the nearest player, with the second input (B) I'm checking if this player has a minimum of 10 levels. How can I achieve this second result with the B input? I know that I can use /testfor but I can't find a full list of all possible commands inside the game.

4

You can test whether a player has a Diamond by running the following command block, with a comparator coming out of it.

 /clear @p Diamond 0

Your comparator will be the output of side one of your AND gate.


You can test for a player's level by using the selector modifiers:

 /testfor @p[lm=10]

As usual, a comparator will have to come out of this command block. Its output will be the other side of your AND gate.

From there, you can create an AND gate as per normal.


To test for the conditions, simply run both command blocks at the same time.

  • I encountered a problem. When I trigger one or both the command blocks, if they return a positive result (true), the comparator next to them stay on and it turns off only when the command block next to it returns a negative result (false) – hiru Sep 18 '15 at 14:32
  • The point of that is to update everytime you need something to be run. @hiru What you could do is make a circuit breaker and at the same time, send a pulse back to those command blocks to render them false (assuming you've done your stuff with other command blocks to make the player return false with those command blocks). Alternatively, running 20Hz clocks also works as well. – aytimothy Sep 18 '15 at 14:48
  • here's an example of what I've done: drive.google.com/open?id=0B3PX6Q5JxdQpVGZuMGRYWUw2ZFk how can I maintain it compact..? – hiru Sep 18 '15 at 15:16
  • Edit: It seems to work adding two redstone torches next to the comparators – hiru Sep 18 '15 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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