Fabric API

Fabric API

108M Downloads

Minecraft crash on launch when any item is registered in fabric mod

Syfou opened this issue ยท 2 comments

commented

I am using Minecraft 1.18.1, Fabric API 0.46.6+1.18, Fabric Installer 0.10.2, and IntelliJ IDEA

Even when I create an empty test mod which does nothing but create and register an item, it crashes on launch in the launcher, although it runs fine from the runClient Gradle target:

public class Froken implements ModInitializer {
    public static final Item HELP = new Item(new FabricItemSettings().group(ItemGroup.MISC));
    @Override
    public void onInitialize() {
        Registry.register(Registry.ITEM, new Identifier("froken", "help"), HELP);
    }
}

A mod compiled a month ago still runs fine, but the same mod compiled today has this issue. Did something change in the Fabric distribution that could cause this? Thanks for any suggestions!

The exact error is:

The game crashed whilst initializing game
Error: java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'froken'!
Exit Code: 255

and the crash log is this:

---- Minecraft Crash Report ----
// Hey, that tickles! Hehehe!

Time: 3/6/22, 3:25 PM
Description: Initializing game

java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'froken'!
	at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.lambda$invoke0$0(EntrypointUtils.java:51)
	at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33)
	at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:49)
	at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke(EntrypointUtils.java:35)
	at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52)
	at net.minecraft.class_310.<init>(class_310.java:452)
	at net.minecraft.client.main.Main.main(Main.java:199)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:416)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
Caused by: java.lang.NoClassDefFoundError: net/minecraft/util/registry/Registry
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:467)
	at net.fabricmc.loader.impl.util.DefaultLanguageAdapter.create(DefaultLanguageAdapter.java:50)
	at net.fabricmc.loader.impl.entrypoint.EntrypointStorage$NewEntry.getOrCreate(EntrypointStorage.java:117)
	at net.fabricmc.loader.impl.entrypoint.EntrypointContainerImpl.getEntrypoint(EntrypointContainerImpl.java:53)
	at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:47)
	... 11 more
Caused by: java.lang.ClassNotFoundException: net.minecraft.util.registry.Registry
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:158)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 17 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.lambda$invoke0$0(EntrypointUtils.java:51)
	at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33)
	at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:49)
	at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke(EntrypointUtils.java:35)
	at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52)
	at net.minecraft.class_310.<init>(class_310.java:452)

-- Initialization --
Details:
	Modules: 
Stacktrace:
	at net.minecraft.client.main.Main.main(Main.java:199)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:416)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)

-- System Details --
Details:
	Minecraft Version: 1.18.1
	Minecraft Version ID: 1.18.1
	Operating System: Mac OS X (x86_64) version 11.6
	Java Version: 17.0.1, Microsoft
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft
	Memory: 570985656 bytes (544 MiB) / 1241513984 bytes (1184 MiB) up to 2147483648 bytes (2048 MiB)
	CPUs: 8
	Processor Vendor: Apple Inc.
	Processor Name: Apple M1
	Identifier: Apple Inc. Family 0x1b588bb3 Model 0 Stepping 0
	Microarchitecture: ARM64 SoC: Firestorm + Icestorm
	Frequency (GHz): 24.00
	Number of physical packages: 1
	Number of physical CPUs: 8
	Number of logical CPUs: 8
	Graphics card #0 name: Apple M1
	Graphics card #0 vendor: Apple (0x106b)
	Graphics card #0 VRAM (MB): 0.00
	Graphics card #0 deviceId: unknown
	Graphics card #0 versionInfo: unknown
	Memory slot #0 capacity (MB): 0.00
	Memory slot #0 clockSpeed (GHz): 0.00
	Memory slot #0 type: unknown
	Virtual memory max (MB): 14336.00
	Virtual memory used (MB): 12373.86
	Swap memory total (MB): 6144.00
	Swap memory used (MB): 5525.25
	JVM Flags: 8 total; -Xss1M -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
	Fabric Mods: 
		apoli: Apoli 2.2.2
		calio: Calio 1.4.2
		cardinal-components-base: Cardinal Components API (base) 4.0.0-alpha.1+21w37a
		cardinal-components-entity: Cardinal Components API (entities) 4.0.0-alpha.1+21w37a
		cloth-basic-math: cloth-basic-math 0.6.0
		cloth-config: Cloth Config v6 6.0.42
		fabric: Fabric API 0.46.6+1.18
		fabric-api-base: Fabric API Base 0.4.2+d7c144a865
		fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.5.3+d7c144a865
		fabric-biome-api-v1: Fabric Biome API (v1) 6.0.2+d7c144a865
		fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.10+3ac43d9565
		fabric-command-api-v1: Fabric Command API (v1) 1.1.7+d7c144a865
		fabric-commands-v0: Fabric Commands (v0) 0.2.6+b4f4f6cd65
		fabric-containers-v0: Fabric Containers (v0) 0.1.19+d7c144a865
		fabric-content-registries-v0: Fabric Content Registries (v0) 0.4.9+d7c144a865
		fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.1.9+3ac43d9565
		fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.10+a1d9bbf565
		fabric-entity-events-v1: Fabric Entity Events (v1) 1.4.6+d7c144a865
		fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.4.17+d7c144a865
		fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.9+d7c144a865
		fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.11+d7c144a865
		fabric-item-api-v1: Fabric Item API (v1) 1.3.1+691a79b565
		fabric-item-groups-v0: Fabric Item Groups (v0) 0.3.7+3ac43d9565
		fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.9+d7c144a865
		fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.7+b4f4f6cd65
		fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 1.4.13+713c266865
		fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.0.9+d7c144a865
		fabric-mining-level-api-v1: Fabric Mining Level API (v1) 1.0.7+d7c144a865
		fabric-mining-levels-v0: Fabric Mining Levels (v0) 0.1.12+b4f4f6cd65
		fabric-models-v0: Fabric Models (v0) 0.3.4+d7c144a865
		fabric-networking-api-v1: Fabric Networking API (v1) 1.0.19+d7c144a865
		fabric-networking-v0: Fabric Networking (v0) 0.3.6+b4f4f6cd65
		fabric-object-builder-api-v1: Fabric Object Builder API (v1) 1.11.5+737332ce65
		fabric-object-builders-v0: Fabric Object Builders (v0) 0.7.13+d7c144a865
		fabric-particles-v1: Fabric Particles (v1) 0.2.10+526dc1ac65
		fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.9.2+ad01bfbd65
		fabric-renderer-api-v1: Fabric Renderer API (v1) 0.4.11+b0b66fc365
		fabric-renderer-indigo: Fabric Renderer - Indigo 0.4.15+6825030165
		fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.10+b4f4f6cd65
		fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.5+d7c144a865
		fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 0.1.19+3ac43d9565
		fabric-rendering-v0: Fabric Rendering (v0) 1.1.12+b4f4f6cd65
		fabric-rendering-v1: Fabric Rendering (v1) 1.10.6+713c266865
		fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 1.0.2+d7c144a865
		fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.4.15+8906aafd65
		fabric-screen-api-v1: Fabric Screen API (v1) 1.0.8+d7c144a865
		fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.1.12+d7c144a865
		fabric-structure-api-v1: Fabric Structure API (v1) 2.1.3+d7c144a865
		fabric-tag-extensions-v0: Fabric Tag Extensions (v0) 1.2.9+d7c144a865
		fabric-textures-v0: Fabric Textures (v0) 1.0.10+3ac43d9565
		fabric-tool-attribute-api-v1: Fabric Tool Attribute API (v1) 1.3.9+fb3b57b465
		fabric-transfer-api-v1: Fabric Transfer API (v1) 1.5.10+c329913d65
		fabricloader: Fabric Loader 0.13.3
		froken: Froken 1.0-SNAPSHOT
		java: OpenJDK 64-Bit Server VM 17
		kanos_config: Kanos Config 0.1.4+1.14.4-1.17.1
		minecraft: Minecraft 1.18.1
		origins: Origins 1.3.1
		pehkui: Pehkui 3.1.0+1.14.4-1.18.1
		playerabilitylib: Pal 1.3.0
		reach-entity-attributes: Reach Entity Attributes 2.1.1
	Launched Version: fabric-loader-0.13.3-1.18.1
	Backend library: LWJGL version 3.2.1 build 12
	Backend API: Unknown
	Window size: <not initialized>
	GL Caps: Using framebuffer using OpenGL 3.2
	GL debug messages: <disabled>
	Using VBOs: Yes
	Is Modded: Definitely; Client brand changed to 'fabric'
	Type: Client (map_client.txt)
	CPU: <unknown>
commented

You can't use the -dev jar outside of a dev environment (with your exact mapping version as well). You should instead use the actual mod jar without the -dev suffix, which works properly in a production MC instance since it uses intermediary names (class_1234 etc).

commented

Thank you so much, that was the issue!