This API makes it easy for mods to add custom fishing loot.
Right now there are just versions for 26.3, for Fabric and NeoForge.
.jarPlace the fishingloothelperapi.jar file into your Minecraft mods folder:
C:\Users\you\AppData\Roaming\.minecraft\mods
Also, place a copy inside your mod's libs folder:
your-mod/
├── libs/
│ └── fishingloothelperapi.jar
├── src/
├── build.gradle
└── ...
build.gradleChange version 1.0.0 to whatever version you are using.
repositories {
flatDir {
dir 'libs'
}
}
dependencies {
implementation 'com.exline:fishingloothelperapi:1.0.0'
}
In neoforge.mods.toml, add:
[[dependencies.${mod_id}]]
modId="fishingloothelperapi"
type="required"
versionRange="[1.0.0,)"
ordering="NONE"
side="BOTH"
For Fabric:
Open src/main/resources/fabric.mod.json and add fishingloothelperapi to the existing depends section:
"depends": {
"fabricloader": ">=0.19.0",
"minecraft": "26.3",
"fishingloothelperapi": ">=1.0.0"
}
Use the API version you are depending on.
The API .jar must also be present in the Minecraft mods folder when running the game.
Register custom fishing loot with this method:
FishRegistry.registerFishingLoot(
Items.BRAIN_CORAL,
10,
FishingEntry.FishingType.FISH
);
Item (Required)
The item being added to the fishing loot can be a vanilla item or custom item.
Items.BRAIN_CORAL
Weight (Required)
The item's weight. Higher weight means a higher chance of being selected.
10
Fishing Loot Type (Optional)
This determines which vanilla fishing pool the item is added to.
FishingEntry.FishingType.FISH
Available types:
FishingEntry.FishingType.FISH
FishingEntry.FishingType.JUNK
FishingEntry.FishingType.TREASURE
FishRegistry.registerFishingLoot(
ModItems.ANCHOVY,
10,
FishingEntry.FishingType.FISH
);
You can optionally choose which biome(s) an item can be caught in.
FishRegistry.registerFishingLoot(
ModItems.ANCHOVY,
10,
FishingEntry.FishingType.FISH,
Biomes.OCEAN
);
FishRegistry.registerFishingLoot(
ModItems.ANCHOVY,
10,
FishingEntry.FishingType.FISH,
Biomes.OCEAN,
Biomes.BEACH
);
You can also use biome tags instead of individual biome keys.
Multiple biome tags can be specified as well.
FishRegistry.registerFishingLoot(
ModItems.ANCHOVY,
10,
FishingEntry.FishingType.FISH,
Tags.Biomes.IS_AQUATIC
);
When no biomes are specified, the item can be caught in any biome.
The same applies to junk and treasure:
FishRegistry.registerFishingLoot(
ModItems.ANCHOVY,
10,
FishingEntry.FishingType.FISH
);
Fishing Loot Helper API uses a weight system based on the vanilla fishing pool.
| Fishing Type | Base Weight |
|---|---|
| Fish | 100 |
| Junk | 110 |
| Treasure | 6 |
Your custom loot is added to the corresponding vanilla pool.
From our earlier example, we have a weight of 10:
FishRegistry.registerFishingLoot(
ModItems.ANCHOVY,
10,
FishingEntry.FishingType.FISH
);
The fish pool becomes:
| Loot | Weight |
|---|---|
| Vanilla fish | 100 |
| Anchovy | 10 |
| Total | 110 |
The Anchovy therefore has a 10/110 chance of being selected, or about 9.09%.
If you add two fish with weight 10:
| Loot | Weight |
|---|---|
| Vanilla fish | 100 |
| Fish A | 10 |
| Fish B | 10 |
| Total | 120 |
Each custom fish has a 10/120 chance of being selected, or about 8.33%.
Base Weight + Added Weights = New Total Weight
Higher weight = more common loot.
More weight added means less chance of getting vanilla loot.
However, you can also add the same vanilla loot to increase the chances again, like cod or salmon.
Fish
| Item | Weight |
|---|---|
| Cod | 60 |
| Salmon | 25 |
| Pufferfish | 13 |
| Tropical Fish | 2 |
| Total | 100 |
Junk
| Item | Weight |
|---|---|
| Lily Pad | 17 |
| Leather Boots | 10 |
| Leather | 10 |
| Water Potion | 10 |
| String | 5 |
| Fishing Rod | 2 |
| Bowl | 5 |
| Stick | 5 |
| Ink Sac | 5 |
| Tripwire Hook | 5 |
| Rotten Flesh | 5 |
| Bamboo | 5 |
| Total | 110 |
Treasure
| Item | Weight |
|---|---|
| Bow | 1 |
| Enchanted Book | 1 |
| Fishing Rod | 1 |
| Name Tag | 1 |
| Nautilus Shell | 1 |
| Saddle | 1 |
| Total | 6 |
You can calculate an item's chance by dividing its weight by the total weight.
For example, if we add a fish with weight 20, the chance of catching Cod goes from 60/100, or 60%, to 60/120, or 50%.
Example Mod
I made an example mod you can use to learn from or just try out. https://github.com/jexline/ogfishmod