Скачать LootJS: KubeJS Addon — Minecraft Моды — ModStock

LootJS: KubeJS Addon

Активный

Установок

24

Последнее обновление

1 месяц назад

Версии

1.18.2 — 1.21.1
Клиент и сервер
Fabric
Forge
Neoforge
Управление
Утилиты

📑 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.