mojira.dev
MC-126696

Provide testfor in the functions on Minecraft 1.13 ?

Hello,
since you've added the functions the game is more attractive when it comes to creating an adventure or creating invisible mechanisms of reduced size. However, i realize that the TestFor command is extremely lacking in functions.

Physically (it works):
(displays mob detected if there is a mob)
repeating_command_block > testfor @a[type=!Player,r=3]
unpowered_comparator
say Mob Detected !

With a function (it does not work):
(displays mob detected even if there is no mob)
testfor @a[type=!Player,r=3]
say Mob Detected !

Look at this link, it's a system that I have to physically create somewhere on the map while the rest of the scenario is invisible 😞 function to create a mechanism

An example of what will save the physical creation of thirty orders...
Command TestFor in a function file "testfor.mcfunction" on 1.13 :

# New system for store and read variables !!!
set msg "MobDetected"
testfor @a[type=!Player,r=3]
{
   say %msg% within a radius of 3 !
}

Open & execute in loop all the 20 ticks (1sec): functionloop testfor 20
Stop loop & Close: functionloop testfor -1

You can add a parameter to set the tick of the flow within a function. Or else, integrate the TestFor command with the same Tick as a repeating_command_block.....

Comments 1

Functions are not conditional to their previous command.

As for testfor in 1.13, use execute if entity

And that last part is a feature request, not a bug.

Perus Ludovic

(Unassigned)

Unconfirmed

Minecraft 1.12.2

Retrieved