ConsumableChemicals
by pluto7073
ConsumableChemicals is a Fabric library that lets a mod attach timed chemical effects to players, such as Haste or Slowness, which tick down over time.
What it does
Chemicals are tracked per player. A mod that wants a new one writes a Chemical Handler, either from scratch by extending ConsumableChemicalHandler or by picking one of the pre-made abstract handlers. The pre-made handlers need only one method implemented. The author text gives HalfLifeChemicalHandler as the example: a chemical whose amount halves every 5 minutes, or 6000 ticks, where tickPlayer handles the per-tick removal until none is left.
Once a handler class is written, it must be registered. The mod adds chemicals to the game itself, so a chemicals command can edit a player's chemical levels, which makes testing possible without playing through the game. Food can carry chemicals as well: a FoodProperties builder has a new method that takes a ResourceLocation for the chemical, the handler itself and an amount, and the player receives the chemical on consuming the item.
Food data for 1.20.5 and later lives in Item Components. Chemicals can be added to items through the ChemicalMap component type, whose ID is chemicals:chemicals, and a simple command gives a steak with 100 units of a chemical as an example. On 1.20.4 and earlier the ChemicalMap.Builder is used for registering a custom item's default chemical amount. The mod is published for Fabric only.
Key features
Timed chemical effects
Each chemical's amount decreases on a tick schedule, and a handler can apply effects such as Haste or Slowness while it lasts.
Pre-made abstract handlers
Ready-made handler classes cover common decay patterns, so a new chemical needs only one method to be implemented.
Chemicals on food
A FoodProperties builder method adds a chemical and amount to any food item, with player consumption applying it.
Item component support
Chemicals can be attached to items through the chemicals:chemicals component, with a separate builder path for older versions.
In-game testing command
A chemicals command edits a player's chemical levels, so effects can be checked without consuming items.
Compatibility
Latest build for each game version and loader.
Only full game releases are shown. This mod publishes no snapshot builds.
Requirements
Dependencies declared by the latest file for each loader.
Required 1
Questions
Does ConsumableChemicals need Fabric API?
Is ConsumableChemicals needed on the server?
Which game versions does ConsumableChemicals support?
How is a chemical added to a food item?
In the catalog
ConsumableChemicals is one of 3,514 Library mods on ModsFinder, and one of 2,348 Library mods for Fabric. 11,154 mods support Minecraft 1.20.6.
More from pluto7073
Similar mods
What the author says
Consumable Chemicals is a library mod that provides functionality for adding chemicals to the game that can be tracked in the player Let's say we want our chemical to have a half-life of 5 minutes, or 6000 ticks. This would get us the below code
Official listing
- Modrinth page
- modrinth.com/mod/chemicals
- Owner
- pluto7073
- Published
- 2024-12-08
- Updated on Modrinth
- 2026-04-06
- Facts verified
- 2026-10-15
