Topic category: Help with Minecraft modding (Java Edition)
I want to make an ENUM blockstate for a block, however, I get an error:
Executing Gradle task: runClient
Build info: MCreator 2023.1.10610, forge-1.19.2, 64-bit, 16332 MB, Windows 10, JVM 17.0.5, JAVA_HOME: C:\Program Files\Pylo\MCreator\jdk, started on: 2023-05-03-15:52:37
> 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\d1\MCreatorWorkspaces\decodesign_objects_and_blocks\src\main\java\net\mcreator\decodesignfunctionsandblocks\block\BarrelForSaltingBlock.java:30: error: cannot find symbol public static final EnumProperty WATER_TYPE = EnumProperty.create("water_type", waterType.class);
^
symbol: class waterType
location: class BarrelForSaltingBlock
C:\Users\d1\MCreatorWorkspaces\decodesign_objects_and_blocks\src\main\java\net\mcreator\decodesignfunctionsandblocks\block\BarrelForSaltingBlock.java:34: error: cannot find symbol this.registerDefaultState(this.stateDefinition.any().setValue(WATER_TYPE, normal));
^
symbol: variable normal
location: class BarrelForSaltingBlock
2 errors
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 9s
1 actionable task: 1 executed
BUILD FAILED
Task completed in 11 seconds
How can I set properties for a state?
Hello! You may have experienced the same problem that I have. I followed this tutorial, https://mcreator.net/forum/87289/tutorial-20221-1182-change-block-modeltexture-ingame, but changed everything related to integer properties to enum. I received the cannot find symbol error and found out thanks to ChatGPT that the enum had to be written this way:
Link to a post I made where I had this problem, but later found the solution: https://mcreator.net/forum/99492/block-enum-property-issue.
I hope this helped!