Test for range of values in a datatag using testforblock

Test for range of values in a datatag using testforblock - Young female in VR glasses standing in light room and testing new device

I want to test for for a range of possible datatag values using the testforblock command. For example if I had a hopper where I want to check if it will transfer soon. For one specific value, I can use:

testforblock ~ ~ ~2 minecraft:hopper 0 {TransferCooldown:0}

But how can I test for a range of values? I tried using [0,1,...] but that didn't work.

In other situations I could also get a continuous value (specifically if I would use modded blocks), so is there any way to add a conditional statement like NBTValue < x or something?






Pictures about "Test for range of values in a datatag using testforblock"

Test for range of values in a datatag using testforblock - Concentrated African American technician wearing lab coat and conducting expertise of motherboard by using screwdrivers while working in service center
Test for range of values in a datatag using testforblock - Crop unrecognizable doctor with vision test device
Test for range of values in a datatag using testforblock - Young positive multiethnic female bloggers testing makeup products while sitting at table and recording vlog on smartphone placed on tripod with ring light



How do you use the TestForBlock command in Minecraft?

You can test whether there is a certain block at a specific location in the game using the /testforblock command in Minecraft....TestForBlock Command in Minecraft Java Edition (PC/Mac)
  • x y z is the coordinate to test. ...
  • block is name of the block to test for. ( ...
  • dataValue is optional. ...
  • dataTag is optional.


  • How do you test inventory items?

    The blank is for the particular block you are looking for. Let's say you're lost in the Nether and need to find your Nether Portal, you could type : /locateblock obsidian, and get the coordinates for the nearest obsidian, most likely being your, said, Portal.



    Learn Command Blocks (Ep 2): Testfor \u0026 Testforblock




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Vanessa Loring, RF._.studio, Anna Shvets, George Milton