Platform and integrations
PlatformInfo answers which mods are loaded and whether the game runs from a development
launch, the same on every loader. RecipeViewers reaches JEI, EMI, and REI without a
dependency on any of them, so a mod can hide items and explain them in whichever viewer the
player has.
At a glance
Section titled “At a glance”| Type | Summary | Status | Since | Side | Thread |
|---|---|---|---|---|---|
PlatformInfo |
Which mods are loaded, their versions, and whether this is a development launch. | Experimental | 2.0.0 | both | any |
RecipeViewers |
Hides stacks from, and adds information pages to, the installed JEI, EMI, and REI viewers. | Experimental | 2.4.0 | both | setup |
Quick start
Section titled “Quick start”With MAPLE_SAPLING, the sapling’s Registered handle, in your mod’s common initializer:
RecipeViewers.info(MAPLE_SAPLING, Component.translatable("info.mymod.maple_sapling"), Component.translatable("info.mymod.maple_sapling.giant"));PlatformInfo
Section titled “PlatformInfo”Experimental · Since 2.0.0 · Side: both · Thread: any
Check for another mod before touching its classes. With SeasonCompat, a class of your mod’s
that calls Serene Seasons, and LOGGER, the mod’s SLF4J logger:
if (PlatformInfo.isModLoaded("sereneseasons")) { // A class of its own, so Serene Seasons' types load only when that mod is installed. SeasonCompat.register(); String version = PlatformInfo.modVersion("sereneseasons").orElseThrow(); LOGGER.info("Maple leaves follow Serene Seasons {}", version);}RecipeViewers
Section titled “RecipeViewers”Experimental · Since 2.4.0 · Side: both · Thread: setup
With MAPLE_SAPLING as in the quick start, and mapleEnabled, a
BooleanSupplier that reads the mod’s settings:
RecipeViewers.hide(() -> mapleEnabled.getAsBoolean() ? List.of() : List.of(new ItemStack(MAPLE_SAPLING.get())));- REI titles an information page with the item’s name.
- JEI and EMI list only items that are in a creative tab, so an item in no tab gets no page there; REI lists it.
- Checked with JEI 15.74.0.234, EMI 1.1.24, and REI 12.1.785 on Minecraft 1.20.1. Their builds for Minecraft 1.20 are not checked.
See also
Section titled “See also”- Networking.
- Using Stope from a mod: adding Stope to a build.