X

NOTICE

Are you sure you want to report this?

We've split up the commands, scripting and mods, and add ons category! Please be sure you get your thread in the right place.

29

Re-add testfor command

14 Comments

Post a new comment:

Please sign in to leave a comment.

  • 0
    Gametron 13 commented
    Comment actions Permalink

    Omg please vote for this! I hate that they removed the /testfor command.

  • 0
    Robin Rogge commented
    Comment actions Permalink

    This would be a step backwards.
    The testfor command is obsolete in 1.13 and it makes sense for it to be removed.

    Here you can get a very detailed overview about the command functionalities, I would suggest playing around with it a bit.

  • 0
    raity41 commented
    Comment actions Permalink

    I Actually rarely used the /testfor command.

  • 0
    tryashtar commented
    Comment actions Permalink

    You learned how to use it before, you can learn the new way too.

    /testfor was almost entirely useless -- whatever selector you put in it could instead be put in the following command.

  • 0
    Comment actions Permalink

    You can still detect an amount of player (or any entity) without using the /testfor. For example, if you want a redstone block to be placing if there is 6 cows in a radius of 6 blocks, you have to do this :

    just one time : /scoreboard objectives add *whatyouwant* dummy

    Then instead of the /testfor command :

    /tag @e[type=cow,distance=..6,sort=random,limit=1] add choose

    /execute as @e[type=cow,distance=..6] run scoreboard players add @e[tag=choose,type=cow,distance=..6] *whatyouwant* 1

    /execute as @e[type=cow,distance=..6,scores={*whatyouwant*=6}] run setblock X Y Z redstone_block

    /scoreboard players set @e[type=cow,distance=..6,tag=choose] *whatyouwant* 0

    /tag @e[tag=choose] remove choose

    If you want to compact this system, you can use another entity to keep the score, or make it into a function.

  • 0
    Comment actions Permalink

    If you are playing on bedrock edition its easy

    /execute is basically using an entity as a command block. for example

    /execute @e[type=zombie] ~ ~ ~ effect @p[r=1.5] instant_damage 1 100

    the part "/execute @e[type=zombie] ~ ~ ~" means the zombie is the command block in this case.

    ONE MORE EXAMPLE:

    you know how you cant hear /playsound from a distance using the command block?

    use /execute @a ~ ~ ~ playsound <name:string> @a ~ ~ ~

    Why? Because the player is basically the command block, so the player makes the sound.

    Hope this helps!

  • 0
    Comment actions Permalink

    YES! I have so many maps that used things like /testfor. One of the worlds has so many of them... it would take me weeks or even months to go around finding all the command blocks and replacing them with /execute

  • 0
    mike bruens commented
    Comment actions Permalink

    also re-add the testforblock and testforblocks commands. please mojang, why did you remove them

  • 0
    amrtarek ct commented
    Comment actions Permalink

    Want to testfor?
    Use : /execute if
    It's for free
    & asking for /testfor back is pointless cause the new system is better
    I was like you (confused) in the begging & hoped the old system were remained but when I experted it I really like the new system

  • 0
    Comment actions Permalink

    just a great yes, please I don't get the use of execute: an hellish hard command whereas with testfor I just have to /testfor me {Inventory:"Minecraft:arrow",count:1} , just try the same thing with execute! yeah you can't, you can't check if an item is in inventory or not with execute. So no comparator, no on-off. Just bring back testfor!

    Execute doesn't even consider multi tags like id + count

  • 0
    Andre Chen commented
    Comment actions Permalink

    @HeliusEagleclaw

    Try this command:

    execute if entity @s[nbt={Inventory:[{id:"minecraft:string"}]}]

    It probably works even better than the testfor example you gave in your comment given the fact that your command was written with completely incorrect syntax.

    Please don't be lazy. Anyone with a few brain cells could not only learn but master the new syntax in less than 10 seconds. It's literally just 2 words.

  • 0
    Comment actions Permalink

    I would love to see it again

  • 0
    Rick Glatz commented
    Comment actions Permalink

    It's not a matter of laziness or not knowing how the new system is "better".  /testfor returned a count, basically the only way to acquire a count is to jury rig something with scoreboards, which is awful, and not at all useful (and also displays to every player everywhere if an OP user issued  the command which is... pretty likely).  A simple numerical returned value for the target is all that is needed for most things, but it's still needed.  The alternative is only a solution if the question being asked is a true/false.  Still need the underlying numeric information to be found somehow.  I thought I saw some way to do this somewhere but can't find it anywhere now so feel free to correct me with an example of say... how to have the number of villagers within 5 blocks appear on the screen without the use of a scoreboard.

    /testfor @e[type=villager,distance=..5] 

  • 0
    Junmion kun commented
    Comment actions Permalink

    testfor command  is my invis trap