Jump to content

[1.19.2] Increased rolls on loot table based on fortune enchantment (datagen or handwritten JSON)


Recommended Posts

Posted (edited)

I have a block that has several possible drops, chosen randomly. I'd like this block to drop multiple items when mined with fortune, each rolled separately. For example, without fortune the block might drop A, B, or C, but with fortune I it might drop A and B, or two of C, or just one B, just as an ore drops 1-2 of its usual drop with fortune I.

I've tried applying fortune to the loot table in the way vanilla does, with the "minecraft:apply_bonus" function. This gives the correct number of drops, but they are always the same. That is, first it determines whether to drop A, B, or C, then it drops 1-2 of that single item, rather than rolling on the table 1-2 times.

As an ugly partial solution, I have tried creating a different loot table for each level of fortune, with the appropriate number of min/max rolls, and then the master table redirects to the fortune 3 table if you have at least fortune 3, otherwise to the fortune 2 table if you have at least fortune 2, etc. This is not ideal because it is very cumbersome, and it doesn't work for fortune levels higher than whatever value I decide to support. I also cannot get it working, but I assume it is possible.

Before I try to fix my ugly solution, is there a clean way to achieve the desired outcome? If it could be done with data generation that would be preferable, as I have a few blocks in the same "family" with similar behaviour, but hand-written JSONs will be feasible if simpler that way.

Edited by fweo
Stated version
  • fweo changed the title to [1.19.2] Increased rolls on loot table based on fortune enchantment (datagen or handwritten JSON)
Posted (edited)
On 6/11/2023 at 3:47 AM, fweo said:

I've tried applying fortune to the loot table in the way vanilla does, with the "minecraft:apply_bonus" function. This gives the correct number of drops, but they are always the same. That is, first it determines whether to drop A, B, or C, then it drops 1-2 of that single item, rather than rolling on the table 1-2 times.

I think this is the correct vanilla behavior for the fortune effect? Not sure if there is a way around this one.

Edit: I mean, this is almost akin to how you can't get the recipe book to recognize damaged items as recipe ingredients for mod recipe types.

Edited by Warren Tode

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.