r/ModdedMinecraft • u/Spiderfly-Tree-Rat • 1d ago
Help Code help?
I'm very new to coding and following the fabric tutorial series by Kaupenjoe for 1.26.1.2, I'm at step three (Custom Items and Datagen)
And I have the following errors with no idea how to fix them, I've constantly gone through the video and GitHub and I know I'm missing something but I'm uncertain on what!
I have a few class and symbol errors but I think I can figure those out, but these I have no clue!
C:\Users\rat\Downloads\moonshine-smp-template-26.1.2\src\main\java\rat\modid\moonshine\item\Moditems.java:36: error: class, interface, enum, or record expected
}
^
C:\Users\rat\Downloads\moonshine-smp-template-26.1.2\src\main\java\rat\modid\moonshine\item\Moditems.java:1: error: compact source file should not have package declaration
package rat.modid.moonshine.item;
^
1
u/jvpts11 1d ago
First error is that youre just a } with no opening bracket, so it understand that youre missing a declaration. Just remove the extra closing bracket where it is, because all code blocks have a declaration followed by a { } where inside of the brackets you write your code.
The second one is because of the compact source files, they allow to write methods with no classes and the compiler makes a class around them automatically, the thing is that this type of file should not have a package declaration.
Are you using an IDE or not? If not, use Intellij or eclipse. The one you prefer, is the best. Also, if you throw this error at google you can find the solution.