MCreator / MCreator

MCreator is software used to make Minecraft Java Edition mods, Bedrock Edition Add-Ons, and data packs using visual graphical programming or integrated IDE. It is used worldwide by Minecraft players, aspiring mod developers, for education, online classes, and STEM workshops.
https://mcreator.net/
Other
889 stars 158 forks source link

Problem with Codes of Code-Editor on Procedures #5205

Closed Anubiyo closed 13 hours ago

Anubiyo commented 1 day ago

Issue tracker rule checks (read carefully)

Issue description

I was making a enchantment mod for minecraft with mcreator, and didnt find the right parts in the normal procedure editor to make some stuff like percentages, so I started up the code editor version of it, and wrote my code there without limits. As I finished and began exporting my mod for its first launch, it told me that some of my elements dont compile with each other ( the code elements I made with code-editor ), I checked but everything was fine I even checked the knowledge Base and similar problems, but nothing helped, so I came here to ask for support and help on why its telling me these errors

How to reproduce this issue?

Step 1: Create a Procedure Step 2: Close and Save the Procedure, and go into code editor Step 3: Add some code Step 4: Save the code without locking the element ( tried it with locking too but doesnt seem to work either way ) Step 5: Try to test launch the mod or export it

Operating system

Windows

Details

Mcreator Version : 2024.3 Generator Version : Neoforge for 1.21.1 (21.1.65)

Example workspace

EnchantedHorizons.zip

Logs

Executing Gradle task: runClient Build info: MCreator 2024.3.42716, neoforge-1.21.1, 64-bit, 49143 MB, Windows 11, JVM 21.0.4, JAVA_HOME: C:\Program Files\Pylo\MCreator\jdk, started on: 2024-12-02-18:09:49

Reusing configuration cache.

Task :createArtifactManifest UP-TO-DATE Task :processResources UP-TO-DATE Task :downloadAssets UP-TO-DATE Task :createMinecraftArtifacts UP-TO-DATE Task :writeClientLegacyClasspath UP-TO-DATE Task :prepareClientRun UP-TO-DATE Task :compileJava FAILED C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Berserk2ProcedureProcedure.java:11: error: class BerserkProcedureProcedure is public, should be declared in a file named BerserkProcedureProcedure.java public class BerserkProcedureProcedure { ^ C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Chillstrike2ProcedureProcedure.java:10: error: class ChillstrikeProcedure is public, should be declared in a file named ChillstrikeProcedure.java public class ChillstrikeProcedure { ^ C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\RicinTouch2ProcedureProcedure.java:10: error: class RicinTouchProcedure is public, should be declared in a file named RicinTouchProcedure.java public class RicinTouchProcedure { ^ C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Satiate2ProcedureProcedure.java:10: error: class SatiateProcedure is public, should be declared in a file named SatiateProcedure.java public class SatiateProcedure { ^ C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Vampiric2ProcedureProcedure.java:11: error: class VampiricProcedure is public, should be declared in a file named VampiricProcedure.java public class VampiricProcedure { ^ C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Berserk2ProcedureProcedure.java:16: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:berserk")) ^ symbol: variable ENCHANTMENT location: class BuiltInRegistries C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Berserk2ProcedureProcedure.java:16: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:berserk")) ^ symbol: method of(String) location: class ResourceLocation C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Berserk2ProcedureProcedure.java:31: error: cannot find symbol baseDamage = itemstack.getAttackDamage(); ^ symbol: method getAttackDamage() location: variable itemstack of type ItemStack C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Berserk2ProcedureProcedure.java:38: error: cannot find symbol targetentity.hurt(DamageSource.playerAttack(player), finalDamage); ^ symbol: method playerAttack(Player) location: class DamageSource C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Chillstrike2ProcedureProcedure.java:15: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:chillstrike")) ^ symbol: variable ENCHANTMENT location: class BuiltInRegistries C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Chillstrike2ProcedureProcedure.java:15: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:chillstrike")) ^ symbol: method of(String) location: class ResourceLocation C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\RicinTouch2ProcedureProcedure.java:15: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:ricin_touch")) ^ symbol: variable ENCHANTMENT location: class BuiltInRegistries C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\RicinTouch2ProcedureProcedure.java:15: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:ricin_touch")) ^ symbol: method of(String) location: class ResourceLocation C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Satiate2ProcedureProcedure.java:15: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:satiate")) ^ symbol: variable ENCHANTMENT location: class BuiltInRegistries C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Satiate2ProcedureProcedure.java:15: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:satiate")) ^ symbol: method of(String) location: class ResourceLocation C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Satiate2ProcedureProcedure.java:20: error: cannot find symbol float damageDealt = targetentity.getLastHurtByMobDamage(); ^ symbol: method getLastHurtByMobDamage() location: variable targetentity of type LivingEntity C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Vampiric2ProcedureProcedure.java:16: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:vampiric")) ^ symbol: variable ENCHANTMENT location: class BuiltInRegistries C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Vampiric2ProcedureProcedure.java:16: error: cannot find symbol BuiltInRegistries.ENCHANTMENT.get(ResourceLocation.of("enchanted_horizons:vampiric")) ^ symbol: method of(String) location: class ResourceLocation C:\Users\Octane PC\MCreatorWorkspaces\enchanted_horizons\src\main\java\net\mcreator\enchantedhorizons\procedures\Vampiric2ProcedureProcedure.java:21: error: cannot find symbol float damageDealt = targetentity.getLastHurtByMobDamage(); ^ symbol: method getLastHurtByMobDamage() location: variable targetentity of type LivingEntity 19 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 --info option to get more log output. Run with --scan to get full insights. BUILD FAILED in 1s 7 actionable tasks: 1 executed, 6 up-to-date Configuration cache entry reused.

BUILD FAILED Task completed in 2 seconds

KlemenDEV commented 1 day ago

Save the code without locking the element

Without locking, your code will be overwritten on the next generation


image

Your ME is called Berserk2Procedure, so generated file name is Berserk2ProcedureProcedure.java, meaning class name must match this, but it your case it doesn't likely due to your code changes.

If you do changes to the code, make sure they are changes that are valid for Java syntax