Minecraft – ny testblock equivalent in 1.14? If so, how would it be used to test for a dispenser with held items

minecraft-commandsminecraft-java-edition

I made a custom crafting table back when the /testblock command was still a thing, and I found out that it's no longer in 1.14? Are there any equivalents? The world was deleted, so I can't go back and copy the code from there. I'm pretty much just trying to find another way to make a custom crafting table using commands.

(PS. The crafting table worked in the way that it would test for the items via the /testblock command inside the dispenser, it would then change the block to a dispenser with the crafted item, and then it would dispense it.)

Best Answer

You can output the result of a check to chat with execute if without a run part, but that's not the main purpose of it.

Before I edited it out, you used the tag for this question, that tells me that you still think of command blocks as mainly redstone components. They do still react to redstone, so that you can for example trigger them with a button, but since 1.7 you don't need it and since 1.9 you should actively avoid it, because using redstone slows down your command system, causes more lag than the alternatives and makes your system more fragile.

Instead, you should think about your command systems as "if X, then do Y to Z" or similar. For example this command says "hi" if there is a chicken near you:

/execute if @e[type=chicken,distance=..5] run say hi

And this command teleports every cow with the "yay" tag to the closest pig (each cow to their respective closest pig, not all to the same):

/execute as @e[type=cow,tag=yay] at @s run tp @s @e[type=pig,sort=nearest,limit=1]

It's not always the most convenient solution to convert your entire system to a single line of chain command blocks attached to a repeating command block, but it is always possible and more often than not a better solution.
Rule of thumb: If you ever attach a comparator to a command block and put something other than a lamp behind it, re-think your system.