Description
Github documentation
This Library uses virtual Item IDs to change the visuals and Tooltips of Items at runtime while keeping mod compatibility. It manages modification requests for all mods that use it to prevent editing conflicts and minimize performance impact.
Why use this lib over direct source integration?
This library is designed to let different mods modify the same item without issues. By integrating the source code directly into your own mod, you risk creating compatibility conflicts with any other mod using that same logic. It is already used by a lot of players and other mods.
Example usage:
Gradle Setup (via CurseMaven):
Add the repository and dependency to your build.gradle:
repositories {
maven { url "[https://cursemaven.com](https://cursemaven.com)" }
}
dependencies {
implementation "curse.maven:dynamictooltipslib-1459711:<fileid>"
}
Replace <fileid> with the ID found at the end of the file's CurseForge URL.
Here is a minimalistic example, please see Github for the full and up-to-date documentation
import org.herolias.tooltips.api.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class MyTooltipProvider implements TooltipProvider {
@Nonnull
@Override
public String getProviderId() {
return "my-mod:stats";
}
@Override
public int getPriority() {
return TooltipPriority.DEFAULT; // 100
}
@Nullable
@Override
public TooltipData getTooltipData(@Nonnull String itemId, @Nullable String metadata) {
if (metadata == null || !metadata.contains("\"my_data\"")) {
return null; // Nothing to contribute
}
return TooltipData.builder()
.hashInput("my_data:v1") // REQUIRED — must be stable & unique per state
.addLine("<color is=\"#55FF55\">+10 Speed</color>")
.build();
}
}
Incompatibility
If the Soft Packets mod is installed, Items may show as invalid Item in certain scenarios for a short time
