Custom Discord RPC

Custom Discord RPC

22.5k Downloads

Do you want to flex your awesome Minecraft experience to your friends?

Do you want to integrate Discord rich text with Minecraft?

Do you want to use custom text with your Discord Rich Presence?

Well, then you're on the right page...!

 This mod allows you to use custom Rich Presence configuration with Discord and is really very powerful.

It starts to work right out of the box with its default config.

However, it can be manually configured to display any information you want in your Discord Rich Presence.

The config file is called 'discordRPconfig.json' and can be found in your config folder.

The config file is a JSON file that stores your config profiles.

NOTE: This is just a summary, for a better description visit This GitHub Page.

Changelog:-

v2.21

  • Added explicit call to discordClearPresence() before stopping RPC to prevent stuck RPC bug.
  • Added more Log messages to show thread stopping.
  • Fixed JUST_STARTED profile not activating.
  • Fixed typo in default config.

v2.2

  • Implemented the Discord callbacks, 'ReadyCallback' and 'DisconnectedCallback'.
  • Added 'sendUpdateNOW()' to immediately send updates when Discord calls the 'ReadyCallback'.
  • Removed 'Discord Update Interval' and 'Script Update Interval Millis' in favor of a single 'Update Interval Millis' because I realized that the update cool down is automatically handled by Discord and I was causing unnecessary delay.
  • Added validation of the RichPresence data before sending updates to Discord which fixes the bug where some updates weren't showing up and didn't cause any error either.
  • Updated default config to have valid data now.

v2.1

  • Added AdvancedConfig with options "Treat First Post-Load Screen As Main-Menu", "Main Menu Full ClassName", "Discord Update Interval" and "Script Update Interval Millis".

  • Added different Main Menu detection mechanics including "Treat First Post Load Screen As MainMenu" and custom "Main Menu ClassName". This is to fix compatibility with menu editor mods.
  • Added validEvent mechanic to prevent/fix skipping of profile activations.
  • Added 4 new Events, 'CONNECTED_TO_SINGLEPLAYER_SERVER', 'DISCONNECTED_FROM_SINGLEPLAYER_SERVER', 'CONNECTED_TO_MULTIPLAYER_SERVER' and 'DISCONNECTED_FROM_MULTIPLAYER_SERVER'.
  • Added Server Related Helper functions.
  • Fixed modScriptEngine#resetEngine() to reset the engine bindings properly.

v2.0 IS OUT

  • Added javascript execution support before each update for finer control of Discord Rich Presence. Remove your current config file to get the new default generated file which uses this feature to see how I used it.
  • Made RPCThread more stable.
  • Goto The GitHub Readme to know how to use this feature.
NOTE: All datatypes are written in square brackets. eg: [String]

The config file stores the Discord APP ID [String] to use. This is required to function and if invalid, malfunctions without any errors.

Each profile allows you to switch your Rich Presence on the fly and stores all the details of how the Rich Presence should look whenever that profile is activated.

Each profile can be set to activate on an inbuilt event that is detected by this mod.

Once a profile is activated, it changes the Rich presence according to its configuration.

Currently, the mod provides the following events:-

  • JUST_STARTED
  • PRE_INIT
  • INIT
  • POST_INIT
  • SERVER_ABOUT_TO_START
  • SERVER_STARTING
  • SERVER_STOPPING
  • SERVER_STOPPED
  • SERVER_STARTED
  • MAIN_MENU_REACHED
  • CONNECTED_TO_SINGLEPLAYER_SERVER
  • DISCONNECTED_FROM_SINGLEPLAYER_SERVER
  • CONNECTED_TO_MULTIPLAYER_SERVER
  • DISCONNECTED_FROM_MULTIPLAYER_SERVER

Each profile has the following properties:-

NOTE: Some String properties have a character limit, See The GitHub ReadMe for more info.

  • "Activation Event" = This stores the activation event of this profile, eg:"MAIN_MENU_REACHED". [String]
  • "Game State" = This is discord's state string. [String]
  • "Details" = This is discord's details string. [String]
  • "Party ID" = This is discord's party ID string. [String]
  • "Party Current Size" = This is discord's party size string. [Integer]
  • "Party Max Size" = This is discord's party size max string. [Integer]
  • "Start Timestamp" = This is discord's start timestamp string. [Integer]
  • "End Timestamp" = This is discord's end timestamp string. [Integer]
  • "Start Time Delay" = When this is set, "Start Timestamp" is ignored and discord is given a startTimestamp that is [profileActivationTime + value] where value is this field's value. [Integer]
  • "End Time Delay" = Similar to "Start Time Delay". [Integer]
  • "Big Image Key" = This is discord's large image key string. [String]
  • "Big Image Hover Text" = This is discord's large image text string. [String]
  • "Small Image Key" = This is discord's small image key string. [String]
  • "Small Image Hover Text" = This is discord's small image text string. [String]
  • "Modification JavaScript" = This is the javascript code that is executed before sending an update to Discord. It uses the Nashorn engine therefore you can use the 'load()' function to load custom js files which will allow you to change the js code without restarting the game. See The GitHub Readme to know more. [String]

Note: If a property is not in the file you can simply add it and it'll work. Just make sure that your JSON file is valid.

To view the source code view: The GitHub Link