Errors while using local variables in "block direction" snippets

Published by Dary on
Issue description

I got compilation errors while using "block direction" snippet with a local number variable in "y":


   
Executing gradle task: build
Build info: MCreator 2019.5.51710, 1.12.2, 64-bit, 16334 MB, Windows 7, JVM 1.8.0_222, JAVA_HOME: C:\Program Files\Pylo\MCreator2\jdk
This mapping 'snapshot_20171003' was designed for MC 1.12! Use at your own peril.
:deobfCompileDummyTask
:deobfProvidedDummyTask
:sourceApiJava UP-TO-DATE
:compileApiJava NO-SOURCE
:processApiResources NO-SOURCE
:apiClasses UP-TO-DATE
:sourceMainJava
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:59: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:85: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:111: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:137: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:172: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:198: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:224: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:250: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
8 errors
:compileJava FAILED
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 10s
5 actionable tasks: 4 executed, 1 up-to-date
BUILD FAILED
Task completed in 15982 milliseconds
   
Executing gradle task: build
Build info: MCreator 2019.5.51710, 1.12.2, 64-bit, 16334 MB, Windows 7, JVM 1.8.0_222, JAVA_HOME: C:\Program Files\Pylo\MCreator2\jdk
This mapping 'snapshot_20171003' was designed for MC 1.12! Use at your own peril.
:deobfCompileDummyTask
:deobfProvidedDummyTask
:sourceApiJava UP-TO-DATE
:compileApiJava NO-SOURCE
:processApiResources NO-SOURCE
:apiClasses UP-TO-DATE
:sourceMainJava UP-TO-DATE
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:59: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:85: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:111: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:137: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:172: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:198: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:224: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
C:\Users\Dary\UN-1\build\sources\main\java\net\mcreator\untouched_nature\MCreatorUNcurtainsUpOnBlockRightClicked.java:250: error: local variables referenced from an inner class must be final or effectively final 
      
                  IBlockState _bs = world.getBlockState(new BlockPos((int) x, (int) ((y - (i)) + 1), (int) z));
                                                                                           ^
8 errors
:compileJava FAILED
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 6s
5 actionable tasks: 3 executed, 2 up-to-date
BUILD FAILED
Task completed in 9612 milliseconds

I upload screenshots of a procedure look.

Below the screen are the same parts for other blocks in "else if" fields.

Issue comments

I can confirm this bug. It applies to some other procedure blocks too. I will fix it in next release / snapshot / patch.

Ok,thanks,I'll hope it will happen soon=)

We have released a second patch update to fix some bugs found in 2020.1:

2020.1.05419

  • Updated Minecraft Forge for 1.14.4 to version 28.1.117
  • [Bugfix, 1.14.4] "Does item stay in crafting grid" option did not work
  • [Bugfix #56587] Some procedure blocks did not work with local variables
  • [Bugfix #56618, 1.14.4] Custom dimension portal igniter worked on any block

If you have update notifications turned on in MCreator, you will be notified if you need to patch on your next launch of MCreator. To apply the patch, redownload and reinstall MCreator 2020.1