Procedure not working

Started by MikecraftThePro on Tue, 06/07/2022 - 20:08

Topic category: Help with modding (Java Edition)

Last seen on 15:43, 6. Jul 2022
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Procedure not working
Tue, 06/07/2022 - 20:12 (edited)

I am making a procedure that will pick a random number from 1 to 100 and if it is 1, it will return true, otherwise it will return false.  The problem is that is says "Procedure that uses return value must end with a valid return block"  Then, when I put a return block after the if-then-else block, it fails to build after saving.

Edited by MikecraftThePro on Tue, 06/07/2022 - 20:12
Last seen on 15:43, 6. Jul 2022
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Edit:  The build log says…
Tue, 06/07/2022 - 20:12

Edit:  The build log says that the return block after the if-then-else is "error: Unreachable Statement" when running task ":complyJava"

Last seen on 15:43, 6. Jul 2022
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
It says in build log:…
Tue, 06/07/2022 - 20:16

It says in build log:

Executing Gradle task: build
Build info: MCreator 2022.1.20510, forge-1.18.2, 64-bit, 12071 MB, Windows 10, JVM 17.0.1, JAVA_HOME: C:\Program Files\Pylo\MCreator\jdk, started on: 2022-06-07-13:15:45
 
> Configure project :
The code of this workspace uses official obfuscation mappings provided by Mojang. These mappings fall under their associated license you should be fully aware of.
(c) 2020 Microsoft Corporation. These mappings are provided "as-is" and you bear the risk of using them. You may copy and use the mappings for development purposes,
but you may not redistribute the mappings complete and unmodified. Microsoft makes no warranties, express or implied, with respect to the mappings provided here.
Use and modification of this document or the source code (in any form) of Minecraft: Java Edition is governed by the Minecraft End User License Agreement available
at https://account.mojang.com/documents/minecraft_eula.
 
> Task :compileJava FAILED
C:\Users\MCreatorWorkspaces\susmod\src\main\java\net\mcreator\susmod\procedures\SusoverlayDisplayOverlayIngameProcedure.java:21: error: unreachable statement  return true;
  ^
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
1 actionable task: 1 executed
 
BUILD FAILED
Task completed in 4 seconds