Fabric API

Fabric API

106M Downloads

java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'tutorial'!

crashtheparty opened this issue ยท 4 comments

commented

This is a copy of the MultiMC log: https://paste.ee/p/Q9I3o

The piece of code being executed when it crashes: ModItems.registerItems();

The ModItems class:

package org.ctp.tutorial.registry;

import org.ctp.tutorial.FabricTutorial;

import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class ModItems {
	public static final Item RUBY = new Item(new Item.Settings().group(ItemGroup.MATERIALS));
	
	public static void registerItems() {
		Registry.register(Registry.ITEM, new Identifier(FabricTutorial.MOD_ID, "ruby"), RUBY);
	}
	
}

It is saying the class "Registry" doesn't exist, which is very odd. Have I missed something here?

commented

How are you running/building the mod?

Your not using a fabric loader entrypoint, it seems to be getting loaded on the wrong class loader?

commented

The jar I used for that one was built with Eclipse -> Export since I didn't realize I needed to build the gradle jar a different way, but I am still getting the same jar issue using the command 'gradlew jar'. New log: https://paste.ee/p/44rom

Also code from the main class, just in case that has an issue:

package org.ctp.tutorial;

import org.ctp.tutorial.registry.ModItems;

import net.fabricmc.api.ModInitializer;

public class FabricTutorial implements ModInitializer {
	
	public static final String MOD_ID = "tutorial";
	
	@Override
	public void onInitialize() {
		System.out.println("Starting initialization...");
		
//		try {
			ModItems.registerItems();
//		} catch (NoClassDefFoundError err) {
//			System.out.println("Class Not Found - try to continue the tutorial anyway.");
//		}
	}
}
commented

You need to use gradlew build and put the jar file in the mods folder.

commented

That worked, thank you.