GeckoLib

GeckoLib

146M Downloads

(Quilt/1.19/Kotlin) Add register method in ItemRegistry

theoparis opened this issue ยท 1 comments

commented

This code in the example item registry seems to be preventing me from using geckolib in quilt 1.19.3 (geckolib 4.0.2).

public static final JackInTheBoxItem JACK_IN_THE_BOX = registerItem("jack_in_the_box", new JackInTheBoxItem(new Item.Settings()));

Correct me if I'm wrong but I had the same issue with my own mod items and it turns out you need to set the item field to the return value of Registry.register. Not sure why the fabric wiki does not reflect this...

// In ItemRegistry
public static final JackInTheBoxItem JACK_IN_THE_BOX = null;

public static void register() {
 JACK_IN_THE_BOX = registerItem("jack_in_the_box", new JackInTheBoxItem(new Item.Settings()));
}

// In the ModInitializer implementation
public void onInitialize(ModContainer mod) {
    ItemRegistry.register();
}
[17:36:29] [Render thread/ERROR] (Minecraft) Unhandled game exception
 java.lang.ExceptionInInitializerError: null
	at software.bernie.example.GeckoLibMod.onInitialize(GeckoLibMod.java:33) ~[geckolib-quilt-1.19.3-4.0.2.jar:4.0.2]
	at net.minecraft.registry.Registries.handler$zkg000$onInitialize(Registries.java:2036) ~[[email protected]:?]
	at net.minecraft.registry.Registries.bootstrap(Registries.java:216) ~[[email protected]:?]
	at net.minecraft.client.MinecraftClient.handler$zjc000$onStart(MinecraftClient.java:5500) ~[[email protected]:?]
	at net.minecraft.client.MinecraftClient.run(MinecraftClient.java:760) ~[[email protected]:?]
	at net.minecraft.client.main.Main.main(Main.java:244) ~[[email protected]:?]
	at net.minecraft.client.main.Main.main(Main.java:51) ~[[email protected]:?]
	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
	at org.quiltmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:475) ~[quilt-loader-0.18.1-beta.25.jar:?]
	at org.quiltmc.loader.impl.launch.knot.Knot.launch(Knot.java:77) ~[quilt-loader-0.18.1-beta.25.jar:?]
	at org.quiltmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:24) ~[quilt-loader-0.18.1-beta.25.jar:?]
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) ~[dev-launch-injector-0.2.1+build.8.jar:?]
Caused by: java.lang.IllegalStateException: This registry can't create intrusive holders
	at net.minecraft.registry.SimpleRegistry.createIntrusiveHolder(SimpleRegistry.java:374) ~[[email protected]:?]
	at net.minecraft.item.Item.<init>(Item.java:64) ~[[email protected]:?]
	at software.bernie.example.item.JackInTheBoxItem.<init>(JackInTheBoxItem.java:36) ~[geckolib-quilt-1.19.3-4.0.2.jar.i0:0/:?]
	at software.bernie.example.registry.ItemRegistry.<clinit>(ItemRegistry.java:17) ~[geckolib-quilt-1.19.3-4.0.2.jar.i0:0/:?]
	... 13 more
commented

Can you test in this non-Kotlin as I have no issue with this version in my own projects.