zPeanut / Hydrogen

An open source, mixin based ghost client for Minecraft 1.8.9 built on Minecraft Forge.
MIT License
147 stars 17 forks source link

discord rpc (i dont know how to add em but i have a code (skid from phobos) #10

Closed ghost closed 3 years ago

ghost commented 3 years ago

code

public static void start() { DiscordEventHandlers handlers = new DiscordEventHandlers(); rpc.Discord_Initialize("795974717890232350", handlers, true, ""); DiscordPresence.presence.startTimestamp = System.currentTimeMillis() / 1000L; DiscordPresence.presence.details = Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu ? "In the main menu." : "Playing " + (Minecraft.getMinecraft().currentServerData != null ? (RPC.INSTANCE.showIP.getValue().booleanValue() ? "on " + Minecraft.getMinecraft().currentServerData.serverIP + "." : " multiplayer.") : " singleplayer."); DiscordPresence.presence.state = RPC.INSTANCE.state.getValue(); DiscordPresence.presence.largeImageKey = "tephra"; DiscordPresence.presence.largeImageText = "Hydrogen 1.4"; rpc.Discord_UpdatePresence(presence); thread = new Thread(() -> { while (!Thread.currentThread().isInterrupted()) { rpc.Discord_RunCallbacks(); DiscordPresence.presence.details = Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu ? "In the main menu." : "Playing " + (Minecraft.getMinecraft().currentServerData != null ? (RPC.INSTANCE.showIP.getValue().booleanValue() ? "on " + Minecraft.getMinecraft().currentServerData.serverIP + "." : " multiplayer.") : " singleplayer."); DiscordPresence.presence.state = RPC.INSTANCE.state.getValue(); if (RPC.INSTANCE.catMode.getValue().booleanValue()) { if (index == 16) { index = 1; } DiscordPresence.presence.largeImageKey = "cat" + index; ++index; } rpc.Discord_UpdatePresence(presence); try { Thread.sleep(2000L); } catch (InterruptedException interruptedException) { } } }, "RPC-Callback-Handler"); thread.start(); }

public static void stop() {
    if (thread != null && !thread.isInterrupted()) {
        thread.interrupt();
    }
    rpc.Discord_Shutdown();
}

}

ghost commented 3 years ago

dm me on discord i could give u the notepad++ format

ghost commented 3 years ago

wait this code is broken sorry