-
Bug
-
Resolution: Fixed
-
23w31a
-
None
-
Confirmed
-
Data Packs
-
Important
-
Platform
/execute if|unless function <function> works normally in chat.
However, if run through a datapack /execute if <function> always fails regardless of the <function>'s return value and /execute unless <function> always succeeds.
- A succeessful call is defined as a function that:
- Uses the return command to return a value
- The return value is not 0
Steps to reproduce:
Create two functions, one that always returns 0 and another that always returns something other than 0.
Run these four commands in chat to get correct behaviour:
/execute if function a:return_0 >Test failed /execute if function a:return_5 >Test passed /execute unless function a:return_0 >Test passed /execute unless function a:return_5 >Test failed
✅ The second and third commands are successful.
Create a function to run these commands:
execute if function a:return_0 run say success 1 execute if function a:return_5 run say success 2 execute unless function a:return_0 run say success 3 execute unless function a:return_5 run say success 4
/function a:test
>Executed 12 commands from function 'a:test'
>success 3
>success 4
❌ The third and fourth commands are successful.
Datapack: bug-2.zip
- relates to
-
MC-264595 Return command cannot run function when inside another function
- Resolved