Home›Java›Mods›LootInj
LootInj
ModsJava

LootInj

Java mod listed for Minecraft 26.x. Downloads from the MC Java Mods app on Android.

by ThePotatoArchivist · on Modrinth

Which Minecraft do you have?

Every version of the game needs its own build. Pick yours, then download — the wrong build installs fine and then does nothing in the game. This mod is built for Fabric only.

⬇ Download for 26.3⬇ Download for 26.1–26.2
I don't know my version or loader
Open the Minecraft launcher and look at the profile you play on — it names both, like fabric-loader-1.21.4. The version also shows in the bottom-right corner of the game's main menu.
No loader in the profile name? Then it's plain Minecraft, and these mods won't run — you need Fabric or NeoForge installed first.

LootInj is a simple data-driven loot modification library, primarily for mods. It essentially acts as a JSON frontend to the Fabric API LootTableEvents.MODIFY event.

Features

Format

In your mod data/datapack, loot modifications are JSON files at data/<namespace>/lootinj/loot_modification/<path>.json. The exact namespace and path do not matter, they should just be unique.

The format generally follows the vanilla loot table format:

26.3+ Format
{
  // All fields are optional except `targets`

  // A loot table id or list of ids to modify
  "targets": [
    "minecraft:blocks/dirt"
  ],

  // A list of loot pools to add
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:diamond"
        }
      ]
    }
  ],

  // A loot function or list of functions to add to the whole table
  "modifier": {
    "count": 2,
    "function": "minecraft:set_count"
  },

  // Modify all existing pools
  // Requires some extra processing so only include if you need to modify pools
  "modify_pools": {
    // Again, all fields are optional

    // A list of entries to add to the pool
    "entries": [
      {
        "type": "minecraft:item",
        "name": "minecraft:gold_ingot"
      }
    ],
    
    // A loot condition or list of conditions to add to the whole pool
    "condition": {
      "type": "minecraft:survives_explosion"
    },

    // A loot function or list of functions to add to the whole pool
    "modifier": {
      "count": 3,
      "function": "minecraft:set_count"
    }

  }

}
26.1-26.2 Format
{
  // All fields are optional except `targets`

  // A loot table id or list of ids to modify
  "targets": [
    "minecraft:blocks/dirt"
  ],

  // A list of loot pools to add
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:diamond"
        }
      ]
    }
  ],

  // A list of loot functions to add to the whole table
  "functions": [
    {
      "count": 2,
      "function": "minecraft:set_count"
    }
  ],

  // Modify all existing pools
  // Requires some extra processing so only include if you need to modify pools
  "modify_pools": {
    // Again, all fields are optional

    // A list of entries to add to the pool
    "entries": [
      {
        "type": "minecraft:item",
        "name": "minecraft:gold_ingot"
      }
    ],
    
    // A list of loot condition to add to the whole pool
    "conditions": [
      {
        "type": "minecraft:survives_explosion"
      }
    ],

    // A list of loot functions to add to the whole pool
    "functions": [
      {
        "count": 3,
        "function": "minecraft:set_count"
      }
    ]

  }

}

Comparison

I made this library because Datapatched did not quite fit my needs:

If you are an end user who doesn't care about these and/or is on Neoforge, Datapatched will probably work better for you as it is better documented and supports more versions & loaders.


Developer Installation

For use in a mod, install and JiJ it from the Modrinth maven.

# gradle.properties
lootinj_version=1.0.2+mc26.3
// build.gradle
repositories {
    exclusiveContent {
        forRepository {
            maven {
                name = "Modrinth"
                url = "https://api.modrinth.com/maven"
            }
        }
        filter {
            includeGroup "maven.modrinth"
        }
    }
}

dependencies {
    // ...
    implementation include("maven.modrinth:lootinj:${project.lootinj_version}")
}
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

File checked by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more