What is supposed to be in / How to regenerate <ModName>ModVariables.java (Accidentaly deleted)

Started by Tyron Orxy on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What is supposed to be in / How to regenerate <ModName>ModVariables.java (Accidentaly deleted)
Fri, 06/13/2025 - 04:13 (edited)

Is there a way to recover a mod file that was deleted in the Workspace File Browser? If not, (how) can I manually recreate it?
MCreator 2025.1, NeoForge, 1.21.1;

(I already checked in the filesystem's trash bin, it's not there.)
 


I tried deleting a mod element by pressing [Del], and made the mistake of not looking which part of MCreator was in focus.
This lead to me accidentally deleting what I assume was <ModNameHere>ModVariables.java .

The console log said:

/home/<Username Here>/MCreatorWorkspaces/hhecknve_sorope/src/main/java/net/mcreator/hhecknvesorope/HhecknveSoropeMod.java:50: error: package HhecknveSoropeModVariables does not exist HhecknveSoropeModVariables.ATTACHMENT_TYPES.register(modEventBus);
^
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler output below.
/home/<Username Here>/MCreatorWorkspaces/hhecknve_sorope/src/main/java/net/mcreator/hhecknvesorope/HhecknveSoropeMod.java:50: error: package HhecknveSoropeModVariables does not exist HhecknveSoropeModVariables.ATTACHMENT_TYPES.register(modEventBus);
^
Note: Recompile with -Xlint:deprecation for details.
1 error
* Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights.
BUILD FAILED in 1s
3 actionable tasks: 1 executed, 2 up-to-date
Configuration cache entry stored.

BUILD FAILED
Task completed in 3 seconds

 

I checked the HhecknveSoropeMod.java file and found that the line in question is at:

public HhecknveSoropeMod(IEventBus modEventBus) {
        // Start of user code block mod constructor
        // End of user code block mod constructor
        NeoForge.EVENT_BUS.register(this);
        modEventBus.addListener(this::registerNetworking);

        HhecknveSoropeModBlocks.REGISTRY.register(modEventBus);
        HhecknveSoropeModBlockEntities.REGISTRY.register(modEventBus);
        HhecknveSoropeModItems.REGISTRY.register(modEventBus);

        HhecknveSoropeModTabs.REGISTRY.register(modEventBus);
        HhecknveSoropeModVariables.ATTACHMENT_TYPES.register(modEventBus); //<-HERE

        HhecknveSoropeModParticleTypes.REGISTRY.register(modEventBus);

        // Start of user code block mod init
        // End of user code block mod init
    }

 

From that syntax I assume I deleted a file called HhecknveSoropeModVariable.java at: Source (Gradle)/net/mcreator/hhecknvesorope/init/HhecknveSoropeModVariable.java

 

The question is: 
If possible, how do I regenerate/get back that file, or what is supposed to be in it, so I can recreate it manually?
 


(Also: never mind the mod name, it's an ai generated phrase.)

Edited by Tyron Orxy on Fri, 06/13/2025 - 04:13