quilt-loader icon indicating copy to clipboard operation
quilt-loader copied to clipboard

Error while runClient

Open NotNekodev opened this issue 2 years ago • 1 comments
trafficstars

I made a mod that adds a custom keybind but it doesnt work:

Error:

Caused by: org.quiltmc.loader.impl.entrypoint.QuiltEntrypointException: Exception while loading entries for entrypoint 'client' provided by 'rebug'

Caused by: org.quiltmc.loader.api.LanguageAdapterException: Class io.github.concrafter20.RebugClient cannot be cast to net.fabricmc.api.ClientModInitializer!

Here is the code from RebugClient:

package io.github.concrafter20;

import io.github.concrafter20.event.KeyInputHandler;
import org.quiltmc.loader.api.ModContainer;
import org.quiltmc.qsl.base.api.entrypoint.client.ClientModInitializer;
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;

public class RebugClient implements ClientModInitializer{

	public void onInitializeClient(ModContainer mod) {
		KeyInputHandler.register();
	}

}

KeyInputHandler:

package io.github.concrafter20.event;

import com.mojang.blaze3d.platform.InputUtil;
import io.github.concrafter20.screens.RebugMenuScreen;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBind;
import org.lwjgl.glfw.GLFW;

public class KeyInputHandler {

	public static final String KEY_CATEGORY_REBUG = "key.category.rebug.rebug";
	public static final String KEY_OPEN_MENU = "key.rebug.open-menu";

	public static KeyBind openMenuKey;

	public static void registerKeyInputs() {
		if (openMenuKey.wasPressed()) {
			MinecraftClient.getInstance().setScreen(new RebugMenuScreen(MinecraftClient.getInstance().currentScreen));
		}
	}

	public static void register() {
		openMenuKey = KeyBindingHelper.registerKeyBinding(new KeyBind(
				KEY_OPEN_MENU,
				InputUtil.Type.KEYSYM,
				GLFW.GLFW_KEY_Z,
				KEY_CATEGORY_REBUG
		));

		registerKeyInputs();
	}
}

And here is quilt.mod.json

{
	"schema_version": 1,
	"quilt_loader": {
		"group": "io.github.github",
		"id": "rebug",
		"version": "${version}",
		"metadata": {
			"name": "Rebug",
			"description": "A cool mod for debug information",
			"contributors": {
				"RaphtikGHG": "Owner"
			},
			"contact": {
				"homepage": "https://example.com/",
				"issues": "https://github.com/QuiltMC/quilt-template-mod/issues",
				"sources": "https://github.com/QuiltMC/quilt-template-mod"
			},
			"icon": "assets/example_mod/icon.png"
		},
		"intermediate_mappings": "net.fabricmc:intermediary",
		"entrypoints": {
			"init": "io.github.concrafter20.Rebug",
			"client": "io.github.concrafter20.RebugClient"
		},
		"depends": [
			{
				"id": "quilt_loader",
				"versions": ">=0.19.1"
			},
			{
				"id": "quilted_fabric_api",
				"versions": ">=7.0.2"
			},
			{
				"id": "minecraft",
				"versions": ">=1.20"
			}
		]
	},
	"mixin": "example_mod.mixins.json"
}

Any idea how i can fix this?

NotNekodev avatar Aug 02 '23 12:08 NotNekodev

Sorry for the delay - you'll need to change client to client_init in your entrypoints - line 23 in quilt.mod.json. (client is for fabric-loaders client initializer).

AlexIIL avatar Aug 04 '23 21:08 AlexIIL

Tbh, this seems a little bit unintuitive when working with a fabric library (I thought they were supposed to be backwards compatibile?), but OK then.

ghost avatar Mar 31 '24 10:03 ghost

Tbh, this seems a little bit unintuitive when working with a fabric library (I thought they were supposed to be backwards compatibile?), but OK then.

It's not unintuitive, you can just open the ClientModInitializer class and find that the key is "client_init".

FirstMegaGame4 avatar Mar 31 '24 14:03 FirstMegaGame4

It's backwards compatible with fabric in the sense that you can use net.fabricmc.api.ClientModInitializer with the fabric entrypoint client - the QSL entrypoint is separate.

AlexIIL avatar Mar 31 '24 15:03 AlexIIL

Oh there was a quilt and fabric mod json. Deleted the quilt one and it worked just fine

ghost avatar Mar 31 '24 17:03 ghost