Developer API
Addon mods can register fish species from code and look up what's loaded. The supported surface is
the net.busybee.ddv_fishing.api package and nothing else: everything outside it (packets,
attachments, minigame rules, renderers) is internal and can change between versions without
notice.
The API is early. Today it covers fish species only.
Dependency
There's no Maven repository for Dreamlight Fishing yet. Compile against the released jar, and
declare the dependency in your fabric.mod.json so your mod loads after it:
dependencies {
modCompileOnly(files("libs/ddv_fishing.jar"))
}
"depends": {
"ddv_fishing": "*"
}
The mod id is also available as DreamlightFishingApi.MOD_ID ("ddv_fishing").
Registering a species
Call it from your mod initializer:
import net.busybee.ddv_fishing.api.DreamlightFishingApi;
import net.busybee.ddv_fishing.api.FishSpecies;
import net.busybee.ddv_fishing.world.FishBiome;
DreamlightFishingApi.registerSpecies(new FishSpecies(
Identifier.of("mymod", "glowfin"),
MyItems.GLOWFIN,
FishBiome.OCEAN,
12.0f, // min size, cm
48.0f, // max size, cm
false // counts toward completion
));
This is the same as shipping data/mymod/ddv_fishing/species/glowfin.json, with two differences:
- A data pack species with the same id overrides yours, so packs can retune your fish.
- Registering the same id twice from code throws
IllegalArgumentException.
The species only adds a journal row and a size roll. Whether it can be caught depends on the loot tables you put its item in.
Leave countsTowardCompletion false unless you mean to move the goalposts: setting it true
re-locks the Legendary tier for every player who has finished the journal. See
Custom Fish Species for the full
field rules.
Lookups
All server-side. Results change when data packs reload.
| Method | Returns |
|---|---|
DreamlightFishingApi.species() |
Every loaded species, in journal order. |
DreamlightFishingApi.species(Identifier id) |
That species, or empty. |
DreamlightFishingApi.speciesForItem(Item item) |
The species a caught item counts as, or empty for junk and treasure. |
FishSpecies is a record: id(), item(), biome(), minSize(), maxSize(),
countsTowardCompletion().
FishSpecies uses FishBiome from net.busybee.ddv_fishing.world for its biome. That type is
outside the api package, so treat it as part of the species signature rather than something to
build on.