CraftPresence
Completely customize the way others see you play Minecraft via Discord's Rich Presence API & the DiscordIPC API by jagrosh!
Port Notes
- Some versions of CraftPresence for Minecraft 1.14.x and above require the FabricMC ModLoader
- Some versions of CraftPresence for Minecraft 1.13.x require the Rift ModLoader
- Versions of CraftPresence for Minecraft 1.1.0 and below require Risugami's ModLoader
Features
In addition to having the ability to change your discord status from "Playing Minecraft", This mod offers plenty of customization options to specify entirely how others see you play. From having your current biome show up, to which dimension your in, as well as which server you're in, and more. The customization possibilities are limitless, with the only real limit being how creative you customize your display.
Launcher and Pack Integration Support
CraftPresence will detect whether your Launch Directory contains:
- A valid Twitch/Overwolf/Curse/GDLauncher Manifest (manifest.json, minecraftinstance.json)
- A MultiMC Instance (instance.cfg)
- A MCUpdater Instance (instance.json)
- A Technic installedPacks File (installedPacks)
If using any of these launchers, it'll put the packs name in your display as well as show its icon (when not in a server).
Note: In v1.6.0 and above, it'll instead parse the Pack's name into the &PACK&
placeholder, that you can configure for
usage in the RPC
As an example, this is how the mod will convert a pack's name to an iconKey:
Example: All the Mods 7
would parse as allthemods7
Note: MultiMC natively has an Icon Key Property that is used instead of converting from the Pack's Display Name
Commands
CraftPresence currently offers the following Commands:
Keep in mind the following:
- Commands must be prefixed by either
/craftpresence
or/cp
- In v1.5.0 and above, these commands are only usable via the Commands Gui, found within the Config Gui
/cp compile "[expr]"
- Test the output of a placeholder expression, via Starscript/cp search (type:typeName, [searchTerm], all)
- Search for valid placeholders available to use with Rich Presence/cp reload
- Reloads mod data/cp request
- View Join Request Info/cp export
- View export commands for mod data-
/cp view
- Help command to display the commands available to view and control a variety of display data/cp view placeholders
- Displays all available placeholders for use in the RPC/cp view currentData
- Displays your Current RPC Data, in text form/cp view assets (custom | all)
- Displays all asset icon keys available to you/cp view dimensions
- Displays all Dimension Names available for use, requiresShow Current Dimension
to be enabled/cp view biomes
- Displays all Biome Names available for use, requiresShow Current Biome
to be enabled/cp view servers
- Displays all Server Addresses available for use, requiresShow Game State
to be enabled/cp view screens
- Displays all Gui Names available for use, if Per-Gui is enabled/cp view items
- Displays all Item Names available for use, if Per-Item is enabled/cp view entities
- Displays all Entity Names available for use, if Per-Entity is enabled
/cp reboot
- Reboots the RPC/cp shutdown
- Shutdown the RPC (Can be turned on from/cp reboot
)/cp (help | ?)
- Help Command to display the above commands and these explanations
KeyBinds
CraftPresence currently contains the following KeyBinds:
Notes:
- In v1.5.5 up to v1.8.0, KeyBinds are now customized in the Accessibility Settings in the Config Gui, and not the normal controls menu
- In v1.8.0 and above, KeyBinds can now be customized in either the dedicated menu in the Config Gui or the normal control menu on applicable versions
Open Config Gui
- KeyBind to open the CraftPresence Config Gui (Default: GRAVE/TILDE Key)
About Placeholders and Functions
In some configuration areas, CraftPresence provides some placeholders and functions to make things easier:
Keep in mind the following:
-
In v2.0.0, placeholders have been rewritten to be compatible
with Starscript
- The older list of this section can be viewed here
- All Placeholders, functions, and code expressions must be surrounded with curly brackets (Example:
{foo.bar}
) - In the event that you need to combine a placeholder with other data in a function argument, use the
getResult
function - Additional functions and standard variables are available within StandardLib
Placeholder List
The following placeholders are available for use anywhere in CraftPresence:
-
General Placeholders:
general.brand
- The Minecraft branding labelgeneral.icon
- The default display icongeneral.version
- The Minecraft version labelgeneral.mods
- The amount of mods currently in your mods folder
-
Menu Event Placeholders (Loading and Main Menu):
menu.message
- The main menu's display data, while applicablemenu.icon
- The main menu's display icon, while applicable
-
Pack Placeholders:
pack.name
- The currently detected pack's namepack.icon
- The currently detected pack's icon
-
Player Placeholders:
player.name
- Your usernameplayer.uuid.short
- Your UUID (Trimmed Format)player.uuid.full
- Your UUID (Full Format, if valid UUID)player.icon
- Your player head icon, while applicableplayer.position.x
- Your current in-game X positionplayer.position.y
- Your current in-game Y positionplayer.position.z
- Your current in-game Z positionplayer.health.current
- Your current in-game healthplayer.health.max
- Your current in-game maximum health
-
Gui Placeholders:
screen.message
- The current Gui Screen's display data, while applicablescreen.name
- The current Gui Screen namescreen.icon
- The current Gui Screen iconscreen.default.icon
- The default Gui Screen icon
-
Biome Placeholders:
biome.message
- The current biome's display data, while in-gamebiome.name
- The current biome namebiome.icon
- The current biome iconbiome.default.icon
- The default biome icon
-
Dimension Placeholders:
dimension.message
- The current dimension's display data, while in-gamedimension.name
- The current dimension namedimension.icon
- The current dimension icondimension.default.icon
- The default dimension icon
-
Entity Placeholders:
entity.default.icon
- The default entity iconentity.target.message
- The currently targeted entity's display data, while applicableentity.target.name
- The currently targeted entity's nameentity.target.icon
- The currently targeted entity's iconentity.riding.message
- The currently riding entity's display data, while applicableentity.riding.name
- The currently riding entity's nameentity.riding.icon
- The currently riding entity's icon
-
World Placeholders:
world.difficulty
- The current world's difficultyworld.name
- The name of the current worldworld.time24
- The current world's in-game time (24-hour format)world.time12
- The current world's in-game time (12-hour format)world.day
- The current world's in-game day count
-
Server Placeholders:
server.message
- The current server's display data, while in-gameserver.icon
- The current server iconserver.default.icon
- The default server iconserver.players.current
- The server's current player countserver.players.max
- The server's maximum player countserver.address.full
- (MP) The raw current server addressserver.address.short
- (MP) The formatted current server addressserver.name
- (MP) The current server nameserver.motd.raw
- (MP) The current raw server motd
-
Item Placeholders:
item.message.default
- The default item display data, while applicableitem.message.holding
- The held item(s) display data, while applicableitem.message.equipped
- The equipped item(s) display data, while applicableitem.[slotId].name
- CurrentslotId
item nameitem.[slotId].message
- CurrentslotId
item message
-
Integration - Replay Mod:
replaymod.time.current
- When in the Video Renderer, retrieves therenderTimeTaken
fieldreplaymod.time.remaining
- When in the Video Renderer, retrieves therenderTimeLeft
field
-
Extra Placeholders (Advanced Usage):
_general.instance
- TheMinecraft
Instance_config.instance
- The Mod Config Instance-
_[moduleName].instance
- An instance of one of the modules CraftPresence has- Module Order:
biome, dimension, entity, item, screen, server, <...>
- Module Order:
data.entity.target.instance
- An instance of the currently targeted entitydata.entity.target.class
- The class object for the currently targeted entitydata.entity.riding.instance
- An instance of the currently riding entitydata.entity.riding.class
- The class object for the currently riding entitydata.item.[slotId].instance
- An instance of the currentslotId
data.item.[slotId].class
- The class object for the currentslotId
data.item.[slotId].[tagName]
- The nbt tagtagName
, within the currentslotId
, if said NBT existsdata.screen.instance
- An instance of the current Gui Screendata.screen.class
- The class object for the current Gui Screendata.server.motd.line.[number]
- Retrieves a specific line ofserver.motd.raw
Function List
The following functions are available for use anywhere in CraftPresence:
getClass(reference=Object|String)
- Attempt to retrieve a class object, via the string path or object referencegetOrDefault(target, alternative ?: '')
- Retrieve the primary value if non-empty; Otherwise, use the secondary valueminify(input, length)
- Reduces the Length of a String to the Specified LengthgetFirst(args)
- Retrieve the first non-null string from the specified arguments, or return nullformatIdentifier(target, formatToId ?: false, avoid ?: false)
- Converts an Identifier into a properly formatted and interpretable NamestripColors(input)
- Strips Color and Formatting Codes from the inputted StringgetField(classObj=Object|String|Class ?: instance.getClass(), instance=Object, fieldName=String)
- Retrieves the Specified Field(s) via ReflectionisUuid(input)
- Checks via Regex whether the specified String classifies as a valid UuidhasWhitespace(input)
- Whether the specified string contains whitespace charactersgetJsonElement(url|jsonString, path=Object...)
- Retrieves the json element from the specified content, or null if unableasIcon(input)
- Converts a String into a Valid and Acceptable Icon FormatrgbaToHex(r,g,b,a ?: 255)
- Converts the specified RGBA color into a Hexadecimal StringconvertTime(input, originalPattern, newPattern)
- Convert the specified string into the specified date format, if ablerandomString(args)
- Retrieves a random element from the specified arguments, as a stringrandomAsset()
- Attempts to retrieve a Random Icon Key from the available assetscapitalizeWords(input, timesToCheck ?: -1)
- Capitalizes the words within a specified stringexecuteMethod(classToAccess=Object|String|Class, instance=Object ?: null, methodName, <parameterType, parameter>...)
- Invokes the specified Method in the Target Class via ReflectionasProperWord(input, avoid ?: false, skipSymbolReplacement ?: false, caseCheckTimes ?: -1)
- Converts input into a Properly Readable StringreplaceAnyCase(input, from, to)
- Replaces Data in a String with Case-InsensitivityhasAlphaNumeric(input)
- Whether the specified string contains alpha-numeric charactersisColor(input)
- Determines whether an inputted String classifies as a valid Color CoderemoveRepeatWords(input)
- Removes Duplicated Words within an inputted StringformatAddress(input, returnPort ?: false)
- Formats an IP Address based on InputnullOrEmpty(input, allowWhitespace ?: false)
- Determines whether a String classifies as NULL or EMPTYlength(input)
- Returns the length of the specified stringtoCamelCase(input)
- Converts a String into a Valid and Acceptable Camel-Case FormatgetResult(input)
- Perform recursive conversion on the specified inputhasField(classToAccess, fieldName)
- Retrieves whether the specified class contains the specified field name
Versions of CraftPresence
Beginning in v1.5.2, CraftPresence is now split into different editions, based on the Minecraft Version you use it in:
-
Legacy Version (Minecraft 1.2.5 and Below):
- Server Support is unavailable in 1.2.5 and Below (Only SinglePlayer will work with showGameStatus enabled)
- Minecraft 1.1.0 and below may not work on Forge, and may require a Modified Minecraft Jar with Risugami's ModLoader + ModLoaderMP
- Alpha 1.1.2_01 has its Dimension and Biome Modules disabled, since the logic for that was not present in the game until a1.2.x
Support for issues related to Vanilla code, Forge, or older/deprecated ModLoaders is extremely limited
Disclaimers & Additional Info
Minecraft Object Obfuscation
Due to obfuscation in Minecraft, some of Minecraft Objects such as Screens, Dimensions, or Servers must be opened once in the session to be separately customized.
This has been resolved in v1.8.12 for MC 1.12.x and below, due to newer Translation Logic, but some issues may still be present.
Icon Requesting
Not seeing an Icon you like or have a suggestion for an Icon to add/modify on the default Client ID?
If so, you can make a request on my Issue Tracker, with the following requirements:
-
If adding an Icon from a dimension, specify the Mod's link that the dimension derives from
- This is because specific Icon IDs must be used, which can be found by the mod or from checking your Logs/Chat after entering the dimension as CraftPresence will tell you the ID expected
-
An Icon of size between
512x512
and1024x1024
to be used (Either minimum or recommended size for best quality)- Icons between these sizes can be used, but may not give a great final quality
-
If requesting an icon to be modified or removed from the Default Client ID, please specify a reason why
- Mostly just so it can be logged why it was changed for future reference
Additionally, you can also create your own Set of Icons by following this guide
Support
Need some assistance with one of my mods or wish to provide feedback?
I can be contacted via the following methods:
Additionally, codebase documentation for this mod is available here with further guides available on the wiki
Licensing
This Mod is under the MIT License as well as the Apache 2.0 License
This project makes usage of the following dependencies internally:
- Starscript by MeteorDevelopment on v2.0 and above
- DiscordIPC API by jagrosh
- Google's Guava Api by Google
- Java Native Access (JNA) API on v1.5.x and below
Discord Terms of Service
As with other RPC Mods, this Mod uses your in-game data to send display information to a 3rd party service (In this Case, Discord).
The terms of service relating to Creating a Discord ID for icons can be found here
The terms of service for using Discord as a service can additionally be located here
I just set the Config Gui Keybind character to F9, and it worked for that session, but when I rebooted the back, it mysteriously became "C."
I then changed it to F10, and again on reboot it changed to "D."
I think something is getting incorrectly transposed/interpreted with respect to that keybind.
More context: I'm using CraftPresence-2.0.0-alpha.2+1.7.10-universal
In reply to AstroTibs:
Please send your latest.log and I'll take a look.
Also send your craftpresence.json config file (Since this is v2)
Hey, this mod looks good! Thank you for doing a modded version.
Do you have 1.19.2? I am not seeing it.Nice wiki, guys!
In reply to LYNRAY_X:
Fixed, CurseForge's markdown parser breaks the link, so I set up a redirect for it.
In reply to CDAGaming_:
still not fixed lol
In reply to Nicebouncetoyourchest:
Fixed once more. Gitlab did more updates (That or CurseForge changed the parser again)
Can't find how to add custom icons for dimentions, please help to find it because gitlab is too hard to understand (why you dont use github?)
Is there a way to show the server icon when playing on a server rather than having the dimension icon?
In reply to Dark_Knight_Batchicken:
Replace &DIMENSION& with &SERVER& in the Large Image Icon field in Presence Settings
In reply to CDAGaming_:
That doesn't seem to work. It just uses the default icon (currently a green circle).
In reply to Dark_Knight_Batchicken:
That is intended in v1.x, since you need to add said server icons. Please refer to the wiki in regards to custom assets.
Is 1.9.6 incompatible with parts of 1.9.5 configs? Grave key isn't working, my biome doesn't show up anymore, small icon doesn't show, and It says that I am in the main menu when I am in singleplayer. This didn't happen with this config in 1.9.5. Here is the config file.
In reply to StormDragon_64:
Please send me a log so I can diagnose this.
The config is useful, but the log is even more useful to tell if this is a crash, as v1.9.6 was just a dependency change from v1.9.5, nothing more.
In reply to CDAGaming_:
https://drive.google.com/uc?export=download&id=19Vzb_B44uR1Z7zT9W7nZMdhu0Wa6VbH5
Sorry it's through google drive, the file was too big for Pastebin.
In reply to StormDragon_64:
Looking through the logs, there is no visible sign of a crash, though a lot of errors coming from *other mods*.
Also, a very small amount of assets in your Client ID, which would normally be ok.
Can you supply a log with Debug Mode and Verbose Mode enabled, or if possible see if a fresh config works as well.
Game crashes when opening the regular control settings if the mod is installed on 1.8.9
In reply to Layout108:
Please send me a log so I can diagnose this.
In reply to CDAGaming_: I think I did this right, not sure how else I could send it though. https://drive.google.com/file/d/1Wmyb5TidioT7ORuBEpeA3O-_nbPd-wtx/view?usp=share_link
In reply to Layout108:
I've found the issue from these logs. It effects 1.11.2 down to 1.7.10, due to the Log4J version that MC uses.
I have fixed the issue and will be rolling out a dot-revision at some point tomorrow to address this after making sure 1.12.2+ are not effected by the dependency change.
Thanks for reporting!
Edit: v1.9.6 should resolve this issue for you, enjoy!