If statement can't be used with Return procedure block

Published by Goldorion on Sat, 07/25/2020 - 01:41
Status
Works as designed
Type
Product/platform
Not applicable
Priority
Normal
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 ;)



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.