If statement can't be used with Return procedure block

Published by Goldorion on
Status
Works as designed
Issue description

I tried to add an additionnal generation condition to one of my ore with a If statement, checking if the biome at x y z was tagged with a biome type, but I got this error Procedure that uses return value must always end with a valid return block. So I tried with the get block at x y z, and I got the same error. Then, i tested in adding else return: false, but it still didn't work. However, when I put the getter to the Return block, everything works perfectly. Theoretically, there is no reason to have this error because I use a return true inside a if statement in the Spigot generator.

Issue comments

You need to provide an additional return below if block.

If you do not do this, there will be no return value specified if the if block does not match.

ADV:

Make Java method, make it return boolean and try to return value only from if, not providing default value ;)

i have the same problem. i want to return true or false but adding a return block at the end would just allow one of the options to actually be returned. so i cant add another return block at the end without limiting the return options to one.

 

i had the same issue, but when i put a return block at the bottom as suggested here, it failed to compile due to an "unreachable statement" which is technically true but how to i do it then