Mods
Resource Packs
Data Packs
Modpacks
Shaders
Plugins
Mods Resource Packs Data Packs Plugins Shaders Modpacks
Get Modrinth App Upgrade to Modrinth+
Sign in
ModsPluginsData PacksShadersResource PacksModpacks
Sign in
Settings
LootJS: KubeJS Addon

LootJS: KubeJS Addon

A Minecraft mod for packdevs to easily modify the loot system with KubeJS.

2.04M
44
Utility

Compatibility

Minecraft: Java Edition

1.21.x
1.20.1
1.19.2
1.18.2

Platforms

Fabric
Forge
NeoForge

Supported environments

Client and server

90% of ad revenue goes to creators

Support creators and Modrinth ad-free with Modrinth+

Links

Report issues View source Visit wiki Join Discord server

Creators

Lytho
Lytho Owner
Relentless
Relentless Member

Details

Licensed LGPL-3.0-only
Published 2 years ago
Updated last month
DescriptionChangelogVersions

📑 Overview

This is a mod for Forge or Fabric and needs KubeJS.

✏️ Your first loot modification

Loot modifications are handled server side. So all your scripts will go into your your_minecraft_instance/kubejs/server_scripts directory. Just create a .js file and let's get started.

Here's simple example which adds a gunpowder for creepers:

onEvent("lootjs", (event) => {
    event
        .addEntityLootModifier("minecraft:creeper")
        .randomChance(0.3) // 30% chance
        .thenAdd("minecraft:gunpowder");
});

Instead of using a loot table for reference, you can also apply the modification to all entities:

onEvent("lootjs", (event) => {
    event
        .addLootTypeModifier(LootType.ENTITY) // you also can use multiple types
        .logName("It's raining loot") // you can set a custom name for logging
        .weatherCheck({
            raining: true,
        })
        .thenModify(Ingredient.getAll(), (itemStack) => {
            // you have to return an item!
            return itemStack.withCount(itemStack.getCount() * 2);
        });
});

Next, let's check if the player holds a specific item:

onEvent("lootjs", (event) => {
    event
        .addBlockLootModifier("#forge:ores") // keep in mind this is a block tag not an item tag
        .matchEquip(EquipmentSlot.MAINHAND, Item.of("minecraft:netherite_pickaxe").ignoreNBT())
        .thenAdd("minecraft:gravel");

    // for MainHand and OffHand you can also use:
    // matchMainHand(Item.of("minecraft:netherite_pickaxe").ignoreNBT())
    // matchOffHand(Item.of("minecraft:netherite_pickaxe").ignoreNBT())
});

⚙️ More Information

For more information about the usage and the functionality of the mod, please visit our wiki or explore the examples.

Modrinth is open source.

main@acf2694

© Rinth, Inc.

Company

TermsPrivacyRulesCareers

Resources

SupportBlogDocsStatus

Interact

Discord X (Twitter) Mastodon Crowdin
Get Modrinth App Settings
NOT AN OFFICIAL MINECRAFT SERVICE. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.