#Custom Ore Silk Touch and Fortune

8 messages · Page 1 of 1 (latest)

sweet sierra
#

Hello,
I'm trying to make a Custom ore that drops Tinker's Cobalt. I've been successful in making it drop the ore in it's raw form, but getting Silk Touch and Fortune to work eludes me. I think I'm supposed to use the pool.addCondition() function but I have a hard time figuring out how it works.

I've read through the "vanilla wiki" and looked at ,JSON files of other mod's ores but I can't grasp it...

placid belfryBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

sweet sierra
#

here is the script I tried to use:

    event.addBlock('kubejs:cobalt_ore', table => {
        table.addPool(pool => {
        pool.addCondition(
            {
            "type": "minecraft:block",
            "pools": [
            {
              "rolls": 1.0,
              "bonus_rolls": 0.0,
              "entries": [
                {
                  "type": "minecraft:alternatives",
                  "children": [
                    {
                      "type": "minecraft:item",
                      "conditions": [
                        {
                          "condition": "minecraft:match_tool",
                          "predicate": {
                            "enchantments": [
                              {
                                "enchantment": "minecraft:silk_touch",
                                "levels": {
                                  "min": 1
                                }
                              }
                            ]
                          }
                        }
                      ],
                      "name": "kubejs:cobalt_ore"
                    },
                    {
                      "type": "minecraft:item",
                      "functions": [
                        {
                          "function": "minecraft:apply_bonus",
                          "enchantment": "minecraft:fortune",
                          "formula": "minecraft:ore_drops"
                        },
                        {
                          "function": "minecraft:explosion_decay"
                        }
                      ],
                      "name": "tconstruct:raw_cobalt"
                    }
                  ]
                }
              ]
            }
          ]
        })
    })
})
})```
manic nimbus
#

misode can help you properly format your jsons and lootjs can give you better programmatic control than kjs for loot tables

odd flumeBOT
#

LootJS is an addon for KubeJS that allows modifying loot from all sources dynamically (much nicer than loot tables)!
It also supports removing loot added by mods, unlike KubeJS' current loot table events.

manic nimbus
#

??misodes

odd flumeBOT
# manic nimbus ??misodes

Misodes is an amazing collection of datapack (and resource pack!) json generators for everything from loot tables to models, dimensions, biomes and other worldgen things.

sweet sierra
#

I got it to work, finally. I'm not that at home with programming so it took me a while but this is the script that makes it work:

    event
        .addBlockLootModifier('kubejs:cobalt_ore')
        .removeLoot('kubejs:cobalt_ore')
        .addLoot('tconstruct:raw_cobalt')
        .applyOreBonus('minecraft:fortune')
        .randomChanceWithEnchantment('minecraft:silk_touch', [0, 1])
        .removeLoot('tconstruct:raw_cobalt')
        .addLoot('kubejs:cobalt_ore')
})```