Jump to content

Recommended Posts

Posted

Hello, I've been trying to find tutorials and syntaxes for registering client commands, but almost all seem to be outdated and do not work anymore. I've built something that my IDE seems to pickup, but when actually using it in practice, an error occurs. I might just be missing something here, so please let me know

log:

Spoiler

---- Minecraft Crash Report ----
// Uh... Did I do that?

Time: 2023-08-30 20:03:40
Description: Mod loading error has occurred

java.lang.Exception: Mod Loading has failed
    at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:60) ~[forge-1.20.1-47.1.29-universal.jar%23135!/:?] {re:classloading}
    at net.minecraftforge.client.loading.ClientModLoader.completeModLoading(ClientModLoader.java:146) ~[forge-1.20.1-47.1.29-universal.jar%23135!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.lambda$new$4(Minecraft.java:571) ~[client-1.20.1-20230612.114412-srg.jar%23130!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.Util.m_137521_(Util.java:421) ~[client-1.20.1-20230612.114412-srg.jar%23130!/:?] {re:classloading}
    at net.minecraft.client.Minecraft.lambda$new$5(Minecraft.java:564) ~[client-1.20.1-20230612.114412-srg.jar%23130!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraftforge.client.loading.ForgeLoadingOverlay.m_88315_(ForgeLoadingOverlay.java:148) ~[forge-1.20.1-47.1.29-universal.jar%23135!/:?] {re:classloading}
    at net.minecraft.client.renderer.GameRenderer.m_109093_(GameRenderer.java:954) ~[client-1.20.1-20230612.114412-srg.jar%23130!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1146) ~[client-1.20.1-20230612.114412-srg.jar%23130!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:718) ~[client-1.20.1-20230612.114412-srg.jar%23130!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:218) ~[minecraft-1.20.1-client.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.1.29.jar:?] {}
    at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) ~[fmlloader-1.20.1-47.1.29.jar:?] {}
    at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25) ~[fmlloader-1.20.1-47.1.29.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?] {}
    at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?] {}
    at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:57) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243) ~[?:?] {}
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278) ~[?:?] {}
    at org.multimc.EntryPoint.listen(EntryPoint.java:143) ~[?:?] {}
    at org.multimc.EntryPoint.main(EntryPoint.java:34) ~[?:?] {}


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

-- Head --
Thread: Render thread
Stacktrace:
    at net.minecraftforge.eventbus.EventBus.registerListener(EventBus.java:153) ~[eventbus-6.0.5.jar%23109!/:?] {}
-- MOD vice --
Details:
    Mod File: /C:/Users/Noah Brewis/Downloads/mmc-develop-win32/MultiMC/instances/1.20.1 Forge Essential/.minecraft/mods/vice-1.0.0.jar
    Failure message: Vice (vice) has failed to load correctly
        java.lang.IllegalArgumentException: Method public static void net.oxyopia.vicemod.Vice$ClientModEvents.RegisterClientCommandsEvent(net.minecraftforge.client.event.RegisterClientCommandsEvent) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.IModBusEvent: class net.minecraftforge.client.event.RegisterClientCommandsEvent
    Mod Version: 1.0.0
    Mod Issue URL: NOT PROVIDED
    Exception message: java.lang.IllegalArgumentException: Method public static void net.oxyopia.vicemod.Vice$ClientModEvents.RegisterClientCommandsEvent(net.minecraftforge.client.event.RegisterClientCommandsEvent) has @SubscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.IModBusEvent: class net.minecraftforge.client.event.RegisterClientCommandsEvent
Stacktrace:
    at net.minecraftforge.eventbus.EventBus.registerListener(EventBus.java:153) ~[eventbus-6.0.5.jar%23109!/:?] {}
    at net.minecraftforge.eventbus.EventBus.lambda$registerClass$2(EventBus.java:86) ~[eventbus-6.0.5.jar%23109!/:?] {}
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?] {}
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?] {}
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?] {}
    at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[?:?] {}
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?] {}
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] {}
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?] {}
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?] {}
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] {}
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?] {}
    at net.minecraftforge.eventbus.EventBus.registerClass(EventBus.java:86) ~[eventbus-6.0.5.jar%23109!/:?] {}
    at net.minecraftforge.eventbus.EventBus.register(EventBus.java:126) ~[eventbus-6.0.5.jar%23109!/:?] {}
    at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.lambda$inject$6(AutomaticEventSubscriber.java:61) ~[javafmllanguage-1.20.1-47.1.29.jar%23132!/:?] {}
    at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] {re:computing_frames}
    at net.minecraftforge.fml.javafmlmod.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:48) ~[javafmllanguage-1.20.1-47.1.29.jar%23132!/:?] {}
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:78) ~[javafmllanguage-1.20.1-47.1.29.jar%23132!/:?] {}
    at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:123) ~[fmlcore-1.20.1-47.1.29.jar%23131!/:?] {}
    at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {}
    at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {}
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}
    at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}
    at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {}
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {}
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {}


-- System Details --
Details:
    Minecraft Version: 1.20.1
    Minecraft Version ID: 1.20.1
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 17.0.8, Eclipse Adoptium
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium
    Memory: 100224488 bytes (95 MiB) / 536870912 bytes (512 MiB) up to 1073741824 bytes (1024 MiB)


    CPUs: 4
    Processor Vendor: GenuineIntel
    Processor Name: Intel(R) Core(TM) i3-4170 CPU @ 3.70GHz
    Identifier: Intel64 Family 6 Model 60 Stepping 3
    Microarchitecture: Haswell (Client)
    Frequency (GHz): 3.69
    Number of physical packages: 1
    Number of physical CPUs: 2
    Number of logical CPUs: 4
    Graphics card #0 name: NVIDIA GeForce GT 710
    Graphics card #0 vendor: NVIDIA (0x10de)
    Graphics card #0 VRAM (MB): 1024.00
    Graphics card #0 deviceId: 0x1289
    Graphics card #0 versionInfo: DriverVersion=30.0.14.7430
    Memory slot #0 capacity (MB): 8192.00
    Memory slot #0 clockSpeed (GHz): 1.60
    Memory slot #0 type: DDR3
    Virtual memory max (MB): 23586.03
    Virtual memory used (MB): 17494.66
    Swap memory total (MB): 15454.88
    Swap memory used (MB): 2142.73
    JVM Flags: 3 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xms512m -Xmx1024m
    ModLauncher: 10.0.9+10.0.9+main.dcd20f30
    ModLauncher launch target: forgeclient
    ModLauncher naming: srg
    ModLauncher services:
        mixin-0.8.5.jar mixin PLUGINSERVICE
        eventbus-6.0.5.jar eventbus PLUGINSERVICE
        fmlloader-1.20.1-47.1.29.jar slf4jfixer PLUGINSERVICE
        fmlloader-1.20.1-47.1.29.jar object_holder_definalize PLUGINSERVICE
        fmlloader-1.20.1-47.1.29.jar runtime_enum_extender PLUGINSERVICE
        fmlloader-1.20.1-47.1.29.jar capability_token_subclass PLUGINSERVICE
        accesstransformers-8.0.4.jar accesstransformer PLUGINSERVICE
        fmlloader-1.20.1-47.1.29.jar runtimedistcleaner PLUGINSERVICE
        modlauncher-10.0.9.jar mixin TRANSFORMATIONSERVICE
        modlauncher-10.0.9.jar fml TRANSFORMATIONSERVICE
    FML Language Providers:
        [email protected]
        lowcodefml@null
        javafml@null
    Mod List:
        client-1.20.1-20230612.114412-srg.jar             |Minecraft                     |minecraft                     |1.20.1              |COMMON_SET|Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
        vice-1.0.0.jar                                    |Vice                          |vice                          |1.0.0               |ERROR     |Manifest: NOSIGNATURE
        forge-1.20.1-47.1.29-universal.jar                |Forge                         |forge                         |47.1.29             |COMMON_SET|Manifest: 84:ce:76:e8:45:35:e4:0e:63:86:df:47:59:80:0f:67:6c:c1:5f:6e:5f:4d:b3:54:47:1a:9f:7f:ed:5e:f2:90
    Crash Report UUID: 0cea140e-2ef9-4f7a-8d6a-26b0720893f2
    FML: 47.1
    Forge: net.minecraftforge:47.1.29

main mod file:

Spoiler
package net.oxyopia.vicemod;

import com.mojang.brigadier.CommandDispatcher;
import com.mojang.logging.LogUtils;
import net.minecraft.commands.CommandSourceStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.oxyopia.vicemod.commands.NBTExtract;
import org.slf4j.Logger;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(Vice.MODID)
public class Vice {
    public static final String MODID = "vice";
    private static final Logger logger = LogUtils.getLogger();

    public Vice() {
        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

        MinecraftForge.EVENT_BUS.register(this);

        ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC);
    }

    @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
    public static class ClientModEvents {
        @SubscribeEvent
        public static void RegisterClientCommandsEvent(RegisterClientCommandsEvent event) {
            CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();

            NBTExtract.register(dispatcher);
        }
    }
}

 

 

Command file:

Spoiler
package net.oxyopia.vicemod.commands;

import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;

public class NBTExtract {
    public static void register(CommandDispatcher<CommandSourceStack> dispatcher){
        dispatcher.register(Commands.literal("nbt").executes(NBTExtract::execute));
    }

    private static int execute(CommandContext<CommandSourceStack> command){
        if(command.getSource().getEntity() instanceof Player player) {
            player.sendSystemMessage(Component.literal("Hello World")); // Test response
        }
        return Command.SINGLE_SUCCESS;
    }
}

 

 

Thanks in advance

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.