Compatibility
Minecraft: Java Edition
1.21.x
1.20.1
1.19.2
1.18.2
Platforms
Fabric
Supported environments
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Creators
Details
Licensed LGPL-3.0-only
Published 2 years ago
Updated last week
📑 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.