#How do I put fortune in the ore with loot table?

16 messages · Page 1 of 1 (latest)

ripe sleet
#

I'm creating an ore that:

  • pickaxe (without enchantment): drops a custom item;
  • pickaxe (with fortune): applies fortune to the custom item;
  • pickaxe (with silk touch): the ore block;

I wanted it to be with lootjs but I still can't get these conditions to work? Does anyone have an example of how to do it or the code ready?

gilded rainBOT
#

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

ripe sleet
#

How do I put fortune in the ore with loot table?

slow scarab
#

this might help #archived-example-scripts message

narrow furnaceBOT
#

[Quote ➤](#archived-example-scripts message) Script to make a block respect fortune.

onEvent('block.loot_tables', event => {
  event.addBlock('emendatusenigmatica:iron_ore', table => {
    table.addPool(pool => {
      pool.addItem('emendatusenigmatica:iron_chunk');
      pool.addFunction({
        "function": "minecraft:apply_bonus",
        "enchantment": "minecraft:fortune",
        "formula": "minecraft:ore_drops"
      });
      pool.addFunction({
        "function": "minecraft:explosion_decay"
      });
    });
  });
});

Edit: added the onEvent

slow scarab
#

theres examples for all of that in the example channels

ripe sleet
#

and how to add silk touch to drop the block

narrow furnaceBOT
#

[Quote ➤](#archived-example-scripts message) This is a script that reduces the influence of fortune on ores for 1.18.
Pseudocode of the loot table:

if (silk touch) then drop fullOre
if (not (silk touch) or is explosion) then drop $rawOre, $rolls times
if (fortune >= 1 and 25% chance) then drop $rawOre, $rolls times
if (fortune >= 2 and 25% chance) then drop $rawOre, $rolls times
if (fortune >= 3 and 25% chance) then drop $rawOre, $rolls times
slow scarab
#

more searching :P

ripe sleet
slow scarab
#

what does your code look like? i cant guess it

ripe sleet
narrow furnaceBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:

```js :arrow_left:
onEvent('recipes', e => {
e.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
``` :arrow_left:

As an example, :arrow_up: will look like this:

onEvent('recipes', e => {
  e.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
ripe sleet
narrow furnaceBOT
#

Paste version of loottables.js from @ripe sleet