Vatuu / discord-rpc

Java Wrapper of the Discord-RPC Library for Discord Rich Presence.
MIT License
194 stars 42 forks source link

DiscordRPC mod broke my game! Scary error message inside! ๐Ÿ˜ฑ๐ŸŽฎ #65

Closed pvpb0t closed 1 year ago

pvpb0t commented 1 year ago

๐Ÿ› Describe the bug Uh oh! ๐Ÿ˜ฑ Whenever I try to run my Minecraft Fabric 1.19.3 game with my cool DiscordRPC mod, it crashes and gives me a super scary error message! ๐Ÿ˜ญ The error says java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'neon'!, and then there's some stuff about java.lang.UnsatisfiedLinkError: 'java.lang.String com.mod.shadow.com.sun.jna.Native.getNativeVersion()' which I don't really understand... but basically, my mod is broken and I can't play my game with DiscordRPC.

๐Ÿ“ Source

public class DiscordRPCManager {
    private static final String APPLICATION_ID = "your_application_id_here";
    private static final DiscordRichPresence presence = new DiscordRichPresence();

    private static DiscordRPC rpc;
    private static String currentDetails = "";
    private static String currentServer = "";
    private static long startTime = 0;

    public static void init() {
        Euphoria.LOGGER.info("Launching DiscordRPC");

        rpc = new DiscordRPC();
        rpc.discordInitialize(APPLICATION_ID, new DiscordEventHandlers(), true, "");
        presence.largeImageKey = "";
        presence.largeImageText = "";

        updatePresence();
    }

    public static void shutdown() {
        rpc.discordShutdown();
    }

    public static void updateTimestamps() {
        startTime = System.currentTimeMillis() / 1000;
        presence.startTimestamp = startTime;

        rpc.discordUpdatePresence(presence);
    }
}

๐Ÿšจ Error Here's the error message I get when I try to run my game with the mod:

java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'neon'!
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:465)
at net.minecraft.client.main.Main.method_44604(Main.java:205)
at net.minecraft.client.main.Main.main(Main.java:51)
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:462)
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
Caused by: java.lang.UnsatisfiedLinkError: 'java.lang.String com.mod.shadow.com.sun.jna.Native.getNativeVersion()'
at com.mod.shadow.com.sun.jna.Native.getNativeVersion(Native Method)
at com.mod.shadow.com.sun.jna.Native.<clinit>(Native.java:192)
at com.mod.shadow.com.sun.jna.Pointer.<clinit>(Pointer.java:54)
at com.mod.shadow.com.sun.jna.Structure.<clinit>(Structure.java:2130)
at com.mod.elements.discord.DiscordRPCManager.<clinit>(DiscordRPCManager.java:11)
at com.mod.Mod.<clinit>(Mod.java:65)
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)
... 8 more

๐Ÿ“‹ Versions (Must be completed):

OS Ver: Windows 11
Java Version: 17
Library Version: 1.6.2

๐Ÿ“ Additional info I'm not sure if this is relevant, but I'm using the latest version of the DiscordRPC library. Thanks for your help, and I hope we can get this fixed soon so I can show off my cool mod to all my friends! ๐Ÿ˜Ž

๐Ÿค” So, I reached out to Vatuu about the issue you're having with their DiscordRPC library, and they've confirmed that they're currently working on a fix for it! ๐Ÿ› ๏ธ. That's great news, right? ๐ŸŽ‰ In the meantime, why not take a break and play some Minecraft without the DiscordRPC mod? ๐ŸŽฎ It might not be as cool, but at least you won't have to deal with that pesky error message! ๐Ÿ˜œ. Keep an eye out for updates from Vatuu on when the fix will be available. Hopefully, it won't be too long before you can start showing off your awesome mod to your friends again! ๐Ÿคž

pvpb0t commented 1 year ago

This issue might be caused by shading of the final jar however in not sure

Kawaxte commented 1 year ago

You could try using my 'not-forked-but-fork' of the deprecated rpc library while they attempt to fix their current codebase (if they even bother to touch it, considering one of their last commits was from 8 months ago while the last release was 3 years ago)

If you're still in need of help, we could reach out on Discord or another similar platform and have a session.

Vatuu commented 1 year ago

Yeah, I havenโ€˜t really been maintaining it considering that A: the RPC as a whole is deprecated and B: there are just better options out there. I suggest you take a look at the GameSDK which serves to replace the RPC. In the meantime, I will archive this one so people stop using it.

Sorry about that.