This guide describes the public API in the current source version 0.5.0. Use the dependency guidance below and check that the mod is loaded when integrating conditionally.
Item Creation Tracker — Modding API
Primary class: com.fyxe.ffitemcreationtracker.api.ItemCreationAPI. The creation component is ffitemcreationtracker:creation; CreationRecord stores creator name and UUID, game day, timestamp, source ID, dimension, biome, moon phase, and custom extras.
Read and write stamps
| Method | Purpose |
|---|---|
get(ItemStack) | Returns Optional<CreationRecord>. |
has(ItemStack) | Whether a stamp exists. |
tryStamp(ItemStack, Player, CreationSource) | Try a built-in source. |
tryStamp(ItemStack, Player, String, Map<String,String>) | Try a custom source and extras. |
putExtra(ItemStack, String, String) | Add or replace an extra on an existing stamp. |
create(Player, String, Map<String,String>) | Construct a record without writing it. |
forceStamp(ItemStack, Player, String) | Write a stamp unconditionally, replacing any existing one. |
tryStamp runs on the logical server, returns true only when it writes a stamp, and respects enabled state, creative/spectator rules, item eligibility, and overwrite settings. When the item already has a stamp and overwriting is off, it records the player as a modifier through CreationHistory.recordModification (no CreationStampEvent) and still returns false. It posts CreationStampEvent before writing.
forceStamp ignores those config gates and does not post CreationStampEvent; it backs the OP-only /ffitemcreationtracker stamp command and is meant for explicit admin actions, not automatic gameplay stamping. There is no API method or command to remove a stamp.
Custom sources and display
Use a namespaced source ID such as mymod:cooking. Call ItemCreationAPI.registerSource(sourceId, byKey, nounKey, nounFirstKey) to supply wording, or provide translation keys. registerExtra(extraKey, formatter) formats an extra field in tooltips. CreationSources.registeredIds() returns every registered source ID, which the stamp command uses for tab completion. Built-in sources include CRAFTED, SMELTED, ANVIL, SMITHING, ENCHANTED, TRADED, FISHED, BREWED, STONECUT, LOOMED, and UNKNOWN.
ItemCreationAPI.tryStamp(result, player, "mymod:cooking", Map.of("mymod:recipe", "stew"));
Built-in detail extras
com.fyxe.ffitemcreationtracker.api.CreationExtras names the extras keys this mod writes itself when the server config allows it. They are added before CreationStampEvent is posted, so a listener can read or remove them; forceStamp records them as well. Values from the caller's own extras map are never overwritten.
| Constant | Key | Values | Server config |
|---|---|---|---|
WEATHER | ffitemcreationtracker:weather | clear, rain, snow, thunder (skylit dimensions only) | recordWeather, default on |
DEPTH | ffitemcreationtracker:depth | deep, underground, underwater, surface, high (skipped in roofed dimensions) | recordDepth, default on |
POSITION | ffitemcreationtracker:position | x,y,z block position | recordCoordinates, default off |
CreationExtras.BUILT_IN holds these keys and MODIFIERS (below). The tooltip draws them with their own client settings instead of the generic extras setting.
ItemCreationAPI.get(stack)
.map(rec -> rec.extras().get(CreationExtras.WEATHER))
.filter("thunder"::equals)
.ifPresent(w -> giveStormBonus(player));
Modification history
CreationExtras.MODIFIERS (ffitemcreationtracker:modifiers) stores the names of players who changed a stamped item, comma separated, oldest first, in the stamp extras. The maker is never listed and a name appears once. Use com.fyxe.ffitemcreationtracker.api.CreationHistory instead of parsing it yourself.
| Method | Purpose |
|---|---|
modifiers(CreationRecord) / modifiers(ItemStack) | Names of the modifiers, oldest first; empty when none. |
recordModification(ItemStack, Player) | Add the player to a stamped stack's history. Returns true when the stack changed; does nothing for the maker, a listed player, an unstamped stack, or when server trackModifications is off. Posts no event. |
withModifier(CreationRecord, String, int) | The history after that name is added (oldest dropped beyond the max), or null when nothing changes. |
parse(String) / join(List<String>) | Convert between the stored string and a list. |
List<String> who = CreationHistory.modifiers(stack);
Pre-write event
com.fyxe.ffitemcreationtracker.api.event.CreationStampEvent is a plain class (not a NeoForge bus event) passed to every listener registered with CreationStampEvents.register(Consumer<CreationStampEvent>). It runs on the logical server after config checks but before the component is written, and works the same on Fabric and NeoForge. Inspect getPlayer(), getStack(), getSourceId(), and getExtras(); call setSourceId, putExtra, or setCanceled(true) to change or stop the stamp. A listener that throws is logged and skipped, so one faulty listener cannot break the click or stop the other listeners. Register once during mod initialization.
CreationStampEvents.register(event -> {
if (event.getSourceId().equals("mymod:cooking")) {
event.putExtra("mymod:station", "campfire");
}
});
Before 0.3.0 this event was posted on NeoForge.EVENT_BUS; listeners written with @SubscribeEvent must move to CreationStampEvents.register.
Dependency coordinates
Each target is published as com.fyxe.ffitemcreationtracker:ffitemcreationtracker-<minecraft>-<loader>:<version> on the Fyxe Gitea Maven registry.
| Minecraft | Loaders | Artifact |
|---|---|---|
| 1.20.6 | Fabric, NeoForge | ffitemcreationtracker-1.20.6-fabric, ffitemcreationtracker-1.20.6-neoforge |
| 1.21.11 | Fabric, NeoForge | ffitemcreationtracker-1.21.11-fabric, ffitemcreationtracker-1.21.11-neoforge |
| 1.21.1 | Fabric, NeoForge | ffitemcreationtracker-1.21.1-fabric, ffitemcreationtracker-1.21.1-neoforge |
| 26.1.2, 26.2 | Fabric, NeoForge | ffitemcreationtracker-26.1.2-fabric, ffitemcreationtracker-26.1.2-neoforge, ffitemcreationtracker-26.2-fabric, ffitemcreationtracker-26.2-neoforge |
| 26.1, 26.1.1, 26.3 | Fabric | ffitemcreationtracker-26.1-fabric, ffitemcreationtracker-26.1.1-fabric, ffitemcreationtracker-26.3-fabric |
Compile against it (compileOnly on NeoForge, modCompileOnly on Fabric) and declare a dependency on ffitemcreationtracker in your loader metadata. The mod is not published for Forge or Minecraft 1.20.1, or for NeoForge on 26.1, 26.1.1 and 26.3.
The mod requires FFUtilities. Add an optional dependency check before calling this API from another mod when Item Creation Tracker is optional.
Tooltip wording for custom sources
Register wording in code, or ship lang keys for your source and extra IDs. For a source mymod:cooking and an extra mymod:note:
tooltip.ffitemcreationtracker.source.mymod.cooking.by
tooltip.ffitemcreationtracker.source.mymod.cooking
tooltip.ffitemcreationtracker.source.mymod.cooking.first
tooltip.ffitemcreationtracker.extra.mymod.note
Built-in CreationSource values: CRAFTED, SMELTED, ANVIL, SMITHING, ENCHANTED, TRADED, FISHED, BREWED, STONECUT, LOOMED, UNKNOWN. Brewed prints as Brewed by, stonecut as Cut by, loomed as Woven by. Anvil and smithing both print as Smithed. Taking an item from a furnace output is stamped SMELTED, a villager trade TRADED, an anvil result ANVIL, a smithing table result SMITHING, a stonecutter result STONECUT, a loom result LOOMED, and any other output slot CRAFTED.